Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrates pytest-metadata and extract verbose to own argument #19

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

jupe
Copy link

@jupe jupe commented Jul 3, 2020

new features

Generate Test Metadata section to markdown report using

--md-metadata (--metadata key=value)

Covers: #8

Breaking change

Extract md --verbose to own md specific argument. This makes possible to run tests with verbose mode but control reporter separately.

--md-verbose

Does not affect generated markdown.

Fixes #18

PR also added one example that simplify testing plugin functionality.

@hackebrot hackebrot added the enhancement New feature or enhancement for pytest-md label Jul 3, 2020
@hackebrot
Copy link
Owner

Thank you for submitting a pull-request to pytest-md, @jupe! 📝

use list style to make md more readable
Copy link
Owner

@hackebrot hackebrot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jupe! 👋

Thanks again for your work on this feature. Your contribution is much appreciated.

I added several comments. Looking forward to the updated pull-request. 📝

examples/conftest.py Outdated Show resolved Hide resolved
examples/test_example.py Outdated Show resolved Hide resolved
src/pytest_md/plugin.py Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
src/pytest_md/plugin.py Outdated Show resolved Hide resolved
""" Create environment section for the Markdown report."""
outcome_text = ""

def _generate_md(items, indentation=0):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to avoid recursion for the sake of comprehensibility. This is how pytest-html generates the metadata section https://github.com/pytest-dev/pytest-html/blob/master/pytest_html/plugin.py#L558

@@ -236,6 +263,18 @@ def pytest_addoption(parser):
default=None,
help="create markdown report file at given path.",
)
group.addoption(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to add metadata to the Markdown report based on whether pytest-metadata is enabled rather than adding an additional CLI option.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might lead unexpected "backwards compatible break" behaviour. User might want to use pytest-metadata and pytest-md and expects that generated markdown is still the same even new version is deployed. This is a bit similar thing that verbose usage earlier (#18), right ? PR makes possible to export metadata to markdown or not regardless pytest-metadata plugin installation. Maybe it's okay even it's always "on". In my case I want to generate markdown document and post it to PR comment. Currently markdown document is a bit annoying long - that's why I implemented also collapse metadata/individual test results here.

dest="md_metadata",
help="Add environment section to report",
)
group.addoption(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd honestly prefer if we stick to the current approach and use --verbose instead of adding an extra CLI option and breaking backwards compatibility. 🤔

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit inconsistent propose against to metadata propose that would make breaks ;) But currently I can survive with original approach without extra CLI option since I did collapsed verbose section in my fork ... :) What's final decision? :) reject original issue #18 or accept it... ?

src/pytest_md/plugin.py Outdated Show resolved Hide resolved
# Check the generated Markdown report
assert report_path.read_text() == report_content
if isinstance(report_content, Pattern):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's create a new test for when pytest-metadata is enabled.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is already test with pytest-metadata is installed and enabled. Did you mean disabled but still installed ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added test with emoji and metadata enabled. Did you mean that ?

@jupe
Copy link
Author

jupe commented Feb 5, 2021

@hackebrot could you check my comments and give some feedback how to continue with PR. Would like to finish this work and drop my fork :)

@jupe
Copy link
Author

jupe commented Oct 25, 2021

@hackebrot could you add comments here since would like to finish my PR... ? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement for pytest-md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

extract pytest-md verbose report from pytest verbose
2 participants