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

pytest v4.0.0 introduces breaking changes to allure-pytest #309

Closed
1 of 3 tasks
neverstew opened this issue Nov 15, 2018 · 2 comments
Closed
1 of 3 tasks

pytest v4.0.0 introduces breaking changes to allure-pytest #309

neverstew opened this issue Nov 15, 2018 · 2 comments

Comments

@neverstew
Copy link

neverstew commented Nov 15, 2018

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

allure-pytest now raises errors where there were previously warnings (see existing issue allure-framework/allure-pytest#146). This occurs due to an upgrade in the severity from warning to error introduced in pytest v4.0.0

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

See two files in this gist
The test has been pinched from an existing issue.

What is the expected behavior?

No errors.

What is the motivation / use case for changing the behavior?

The library will not work without this fix.

Please tell us about your environment:

  • Allure version: 2.1.0
  • Test framework: pytest@4.0.0
  • Allure adaptor: allure-pytest@2.5.3
@neverstew
Copy link
Author

From: #307

https://github.com/allure-framework/allure2/issues/862
find the allure source code in the site packages, edit the utils.py's 3 functions.

  • def get_marker_value(item, keyword)
  • def allure_labels(item)
  • def allure_links(item)
### in utils.py
def get_marker_value(item, keyword):
    #marker = item.keywords.get(keyword)
    marker = item.get_closest_marker(keyword)
    return marker.args[0] if marker and marker.args else None


def allure_labels(item):
    for keyword in item.keywords.keys():
        if keyword.startswith(ALLURE_LABEL_PREFIX):
            #marker = item.get_marker(keyword)
            marker = item.get_closest_marker(keyword)
            label_type = marker.kwargs['label_type']
            if label_type in ALLURE_UNIQUE_LABELS:
                yield (label_type, marker.args[0])
            else:
                for value in marker.args:
                    yield (label_type, value)


def allure_links(item):
    for keyword in item.keywords.keys():
        if keyword.startswith(ALLURE_LINK_PREFIX):
            #marker = item.get_marker(keyword)
            marker = item.get_closest_marker(keyword)
            link_type = marker.kwargs['link_type']
            url = marker.args[0]
            name = marker.kwargs['name']
            yield (link_type, url, name)

@sseliverstov
Copy link
Contributor

fixed in #306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants