allure-framework / allure-pytest

Deprecated, please use https://github.com/allure-framework/allure-python instead
Other
171 stars 83 forks source link

Warnings during generating of allure report - RemovedInPytest4Warning #146

Closed yshovkun-cartera closed 5 years ago

yshovkun-cartera commented 6 years ago

I updated my pytest to the latest version and started getting an errors during allure report generation. However as I can see, you fully support it with the latest version.

Package Version


allure-pytest 2.5.2 allure-python-commons 2.5.2 atomicwrites 1.2.1 attrs 18.2.0 certifi 2018.8.24 chardet 3.0.4 colorama 0.3.9 enum34 1.1.6 idna 2.7 lxml 4.2.5 more-itertools 4.3.0 namedlist 1.7 pip 18.1 pluggy 0.7.1 py 1.6.0 pytest 3.8.2 requests 2.19.1 setuptools 40.4.3 six 1.11.0 urllib3 1.23

OS: Windows 10 Enterprise x64

Warning example: ============================== warnings summary ===============================

\lib\site-packages\allure_pytest\utils.py:46: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly. Please use node.get_closest_marker(name) or node.iter_markers(name). Docs: https://docs.pytest.org/en/latest/mark.html#updating-code label_type = marker.kwargs['label_type'] \lib\site-packages\allure_pytest\utils.py:50: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly. Please use node.get_closest_marker(name) or node.iter_markers(name). Docs: https://docs.pytest.org/en/latest/mark.html#updating-code for value in marker.args: \lib\site-packages\allure_pytest\utils.py:46: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly. Please use node.get_closest_marker(name) or node.iter_markers(name). Docs: https://docs.pytest.org/en/latest/mark.html#updating-code label_type = marker.kwargs['label_type'] \lib\site-packages\allure_pytest\utils.py:48: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly. Please use node.get_closest_marker(name) or node.iter_markers(name). Docs: https://docs.pytest.org/en/latest/mark.html#updating-code yield (label_type, marker.args[0]) \lib\site-packages\allure_pytest\utils.py:58: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly. Please use node.get_closest_marker(name) or node.iter_markers(name). Docs: https://docs.pytest.org/en/latest/mark.html#updating-code link_type = marker.kwargs['link_type'] \lib\site-packages\allure_pytest\utils.py:59: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly. Please use node.get_closest_marker(name) or node.iter_markers(name). Docs: https://docs.pytest.org/en/latest/mark.html#updating-code url = marker.args[0] \lib\site-packages\allure_pytest\utils.py:60: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly. Please use node.get_closest_marker(name) or node.iter_markers(name). Docs: https://docs.pytest.org/en/latest/mark.html#updating-code name = marker.kwargs['name'] -- Docs: https://docs.pytest.org/en/latest/warnings.html ==================== 1 passed, 7 warnings in 2.42 seconds ===================== Process finished with exit code 0
michalkrysciak commented 6 years ago

Hello. I see the same warnings with the same pytest and allure versions. And I use macOS High Sierra ver. 10.13.6. I have a lot of tests and I see ~3500 such warnings O_o

tsbxmw commented 5 years ago

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 commented 5 years ago

fixed