Pytest 4.5.0 now displays warning for non declared markers (Eventually errors)
When using allure, we are now seeing the following outputs with pytest 4.5.0 (These warnings are eventually going to become errors in pytest 4.6.0 (or some time similar)
some (but not all examples are):
PytestUnknownMarkWarning,_pytest/mark/structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.allure_label.epic - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html PytestUnknownMarkWarning,
pytest.mark.allure_label.feature - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html PytestUnknownMarkWarning,
pytest.mark.allure_label.story - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.htmlPytestUnknownMarkWarning,
#5023: New flag --strict-markers that triggers an error when unknown markers (e.g. those not registered using the markers option in the configuration file) are used in the test suite.
The existing --strict option has the same behavior currently, but can be augmented in the future for additional checks.
https://docs.pytest.org/en/latest/changelog.html
This is a big problem for allure, especially in future because of:
packages/_pytest/mark/structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.allure_link.issue:PE-28550 - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html PytestUnknownMarkWarning,
These markers are dynamic
@sseliverstov thoughts?
From Py.Test docs:
Registered marks appear in pytest’s help text and do not emit warnings (see the next section). It is recommended that third-party plugins always register their markers.
Registering custom markers.
For demo purposes, I loaded up https://github.com/ehborisov/allure2-pytest-demo and ran with pytest 4.5.0. I was able to get around a bunch for now, using the pytest.ini file like so:
addopts = --strict-markers
markers =
allure_description: Allure Marker
allure_description_html: Allure Marker
allure_link: Allure Marker
allure_link.link: Allure Marker
allure_link.issue: Allure Marker
allure_label.feature: Allure Marker
allure_title: Allure Marker
I noticed was everything in this test file was broken, and unable to be added to the pytest.ini file. . For some reason, the marker was including the actual link if you look at the '.
This was for all the tests in the above linked file (allure pytest demo)
allure.link marking #1
@allure.feature('Links')
@allure.link('https://www.youtube.com/watch?v=4YYzUTYZRMU')
Error for #1
'allure_link.link:https://www.youtube.com/watch?v=4YYzUTYZRMU' not found in `markers` configuration option
allure.link marking #2
@allure.feature('Links')
@allure.link('https://www.youtube.com/watch?v=Su5p2TqZxKU', name='Click me')
Error:
'allure_link.link: https://www.youtube.com/watch?v=Su5p2TqZxKU' not found in `markers` configuration option
allure.link.issue marking:
@allure.feature('Links')
@allure.issue('140', 'Pytest-flaky test retries shows like test steps')
Error:
'allure_link.issue:140' not found in `markers` configuration option
Allure testcase marking:
TEST_CASE_LINK = 'https://github.com/qameta/allure-integrations/issues/8#issuecomment-268313637'
@allure.feature('Links')
@allure.testcase(TEST_CASE_LINK, 'Test case title')
Error:
'allure_link.test_case:https://github.com/qameta/allure-integrations/issues/8#issuecomment-268313637' not found in `markers` configuration option
Even when adding the whole of what is in single quotes as a mark. (most likely from the parsing of the file having multiple :
Hope this helps those with warning, and those awesome amazing folks maintaining Allure!
Hi, i had the same problem. Are there any updates ?
The current pytest plan is to just do bugfixes until the py2 depreciation. https://docs.pytest.org/en/latest/py27-py34-deprecation.html Likely, this will mean we can live in the warning state for a while, and the 'eventually errors' is quite a while away.
This is very annoying.
will be fixed on next release
Still have this issue in pytest 5.0.1 Fixed by adding filter into pytest.ini
[pytest]
filterwarnings = ignore:.*PytestUnknownMarkWarning*
@akropyva-apixio may i know the file location of pytest.ini, and can you please elaborate what changes you did to make it run.
Thanks in Advance, Dilip
@dilipvaze purest.ini is located into root directory.
pytest -m active_time_hcc -v -s -n 3 --reportportal --rp-launch="Active Time HCC Identifier"
[pytest]
filterwarnings = ignore:.PytestUnknownMarkWarning
log_level=INFO
log_format = %(asctime)s %(levelname)s %(message)s
log_date_format = %Y-%m-%d %H:%M:%S
rp_uuid = 1111
rp_endpoint = 1111
rp_project = 1111
rp_verify_ssl = False
markers =
integration_hcc
api_hcc
api_quality_id
ui_quality_id
ui_sanity_hcc
ui_flows_hcc
v22
v23
react_product
angular_product
reject_structure
skp_functionality
accept_functionality
reject_functionality
accept_structure
team_page
project_settings_page
project_history
proj_history_search
project_history_permission
productivity_coders
demo
doc_gap
docgap
test_dashboard_pages
icd_filter
project_history_new
dashboard
qa_routing
rebundle
state_machine
manual_coding
active_time_hcc_full
v23optum
large_v22_history
v23combined
active_time_hcc
active_time_hcc_phases
active_opps_per_hour
ui_flows
@akropyva-apixio @dilipvaze Can you show full text of warnings? If it allure markers I will fix it
@sseliverstov This is the full text of the warning:
foo-ve/lib/python3.6/site-packages/_pytest/mark/structures.py:327
/builds/Carrene/owl/owl-ve/lib/python3.6/site-packages/_pytest/mark/structures.py:327: PytestUnknownMarkWarning: Unknown pytest.mark.asyncio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
PytestUnknownMarkWarning,
-- Docs: https://docs.pytest.org/en/latest/warnings.html```
`pytest==5.3.1`
This is not Robot framework related, you have a pytest marker asyncio that needs to be added to your pytest.ini file, under markers.
[pytest]
markers =
asyncio
I see this issue with 2.222.1 also.
My pytest.ini contains:
[pytest]
markers =
smoke: mark test as smoke test
Warning Unknown pytest.mark.smoke - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html