ansible-community / molecule-plugins

Collection on molecule plugins
MIT License
109 stars 73 forks source link

Tests failing with newer versions of pytest (?): "Test xxx has an id that does not match our safe pattern" #198

Closed johanneskastl closed 10 months ago

johanneskastl commented 10 months ago

I noticed the openSUSE package for molecule-plugins fails to build with the following error. I already asked in the molecule discussions on where to report this, in case this needs to be fixed upstream. Sorry, my python and pytest knowledge is limited in this regard, so I am not sure where this comes from, but as this error is new but the package was not updated, it looks like some dependency was updated and causes this. My guess would be pytest...

[   10s] ============================= test session starts ==============================
[   10s] platform linux -- Python 3.11.5, pytest-7.4.3, pluggy-1.3.0 -- /usr/bin/python3.11
[   10s] cachedir: .pytest_cache
[   10s] rootdir: /home/abuild/rpmbuild/BUILD/ansible-compat-4.1.10
[   10s] configfile: pyproject.toml
[   10s] testpaths: test
[   10s] plugins: plus-0.0.0, mock-3.12.0
[   11s] collecting ... ERROR: Failed run due to following issues being identified:
[   11s] 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.
[   11s] 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.
[   11s] 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.
[   11s] 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.
[   11s] 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.
[   11s] 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.
[   11s] 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.
[   11s] 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.
[   11s] 
[   11s] collected 93 items
[   11s] 
[   11s] ============================ no tests ran in 0.19s =============================
johanneskastl commented 10 months ago

Found the fix in https://github.com/ansible-community/molecule-plugins/commit/bae14d88c4ee8baf9736df6a21b2d414235683ff and backported it to match the last release. That gets rid of the errors...