Skip to content

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

Closed

Description

@neverstew

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

Activity

  1. neverstew commented on Nov 15, 2018

    @neverstew
    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)
    
  2. sseliverstov commented on Nov 19, 2018

    @sseliverstov
    Contributor

    fixed in #306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions