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

Tests failing with newer versions of pytest-plus: "has an id that does not match our safe pattern '^[\w_\-\.]+$' for use with a terminal" #340

Closed
johanneskastl opened this issue Nov 23, 2023 · 2 comments · Fixed by pytest-dev/pytest-plus#25 or #347

Comments

@johanneskastl
Copy link

Newer versions of pytest-plus are complaining because the naming of the tests is not safe:

[   32s] ============================= test session starts ==============================
[   32s] platform linux -- Python 3.11.5, pytest-7.4.3, pluggy-1.3.0 -- /usr/bin/python3.11
[   32s] cachedir: .pytest_cache
[   32s] rootdir: /home/abuild/rpmbuild/BUILD/ansible-compat-4.1.10
[   32s] configfile: pyproject.toml
[   32s] testpaths: test
[   32s] plugins: mock-3.12.0, plus-0.0.0
[   32s] collecting ... ERROR: Failed run due to following issues being identified:
[   32s] Test <Function test__update_env_no_old_value_no_default[value1-a:b]> has an id that does not match our safe pattern '^[\w_\-\.]+$' for use with a terminal.
[   32s] Test <Function test__update_env_no_old_value_no_default[value2-a:b:c]> has an id that does not match our safe pattern '^[\w_\-\.]+$' for use with a terminal.
[   32s] Test <Function test__update_env_no_old_value[a:b-value0-c:a:b]> has an id that does not match our safe pattern '^[\w_\-\.]+$' for use with a terminal.
[   32s] Test <Function test__update_env_no_old_value[a:b-value1-c:d:a:b]> has an id that does not match our safe pattern '^[\w_\-\.]+$' for use with a terminal.
[   32s] Test <Function test__update_env_no_default[a:b-value0-c:a:b]> has an id that does not match our safe pattern '^[\w_\-\.]+$' for use with a terminal.
[   32s] Test <Function test__update_env_no_default[a:b-value1-c:d:a:b]> has an id that does not match our safe pattern '^[\w_\-\.]+$' for use with a terminal.
[   32s] Test <Function test__update_env[a--value1-e:a]> has an id that does not match our safe pattern '^[\w_\-\.]+$' for use with a terminal.
[   32s] Test <Function test__update_env[a-c-value3-e:f:a]> has an id that does not match our safe pattern '^[\w_\-\.]+$' for use with a terminal.
[   32s] 
[   32s] collected 93 items

I have not found a fix in the list of commits, did I just miss it or is there none yet?

Kind Regards,
Johannes

@sebix
Copy link

sebix commented Nov 24, 2023

The check can be disabled with

PYTEST_CHECK_TEST_ID_REGEX=0

See https://github.com/pytest-dev/pytest-plus#user-content-avoiding-problematic-test-identifiers

@johanneskastl
Copy link
Author

Thanks @sebix! I think the test names should finally be fixed upstream like in other ansible-related tools. But for now at least the openSUSE package is building again...

ssbarnea added a commit to pytest-dev/pytest-plus that referenced this issue Jan 10, 2024
ssbarnea added a commit to pytest-dev/pytest-plus that referenced this issue Jan 10, 2024
ssbarnea added a commit that referenced this issue Jan 10, 2024
ssbarnea added a commit that referenced this issue Jan 10, 2024
* Update test dependencies

Fixes: #340

* chore: auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants