-
Notifications
You must be signed in to change notification settings - Fork 248
Open
Labels
Description
I do have a local pytest plugin that causes some runtime warnings from another dependency.
As these were not a reason to concern, we used filterwarning inside pytest.ini in order to catch and remove them when running tests. The problem is that when run with xdist the filtering no longer happens and we endup with one warning for each CPU.
I think that this happens because the import causing the warnings is happening inside a pytest plugin and before pytest-cov is even loaded but I was not able to find any way to prevent it from happening.
Run with xdist
<frozen importlib._bootstrap>:914: ImportWarning: _AnsibleCollectionFinder.find_spec() not found; falling back to find_module()
=========================================================== test session starts ============================================================
platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /Users/ssbarnea/c/a/ansible-lint, configfile: pytest.ini
plugins: markdown-1.0.2, flaky-3.7.0, mock-3.6.1, xdist-2.4.0, plus-0.2, forked-1.3.0, cov-3.0.0
gw0 C / gw1 C / gw2 C / gw3 C / gw4 C / gw5 C / gw6 C / gw7 C<frozen importlib._bootstrap>:914: ImportWarning: _AnsibleCollectionFinder.find_spec() not found; falling back to find_module()
gw0 ok / gw1 C / gw2 C / gw3 C / gw4 C / gw5 C / gw6 C / gw7 C<frozen importlib._bootstrap>:914: ImportWarning: _AnsibleCollectionFinder.find_spec() not found; falling back to find_module()
gw0 ok / gw1 ok / gw2 C / gw3 C / gw4 C / gw5 C / gw6 C / gw7 C<frozen importlib._bootstrap>:914: ImportWarning: _AnsibleCollectionFinder.find_spec() not found; falling back to find_module()
gw0 ok / gw1 ok / gw2 ok / gw3 C / gw4 C / gw5 C / gw6 C / gw7 C<frozen importlib._bootstrap>:914: ImportWarning: _AnsibleCollectionFinder.find_spec() not found; falling back to find_module()
gw0 ok / gw1 ok / gw2 ok / gw3 ok / gw4 C / gw5 C / gw6 C / gw7 C<frozen importlib._bootstrap>:914: ImportWarning: _AnsibleCollectionFinder.find_spec() not found; falling back to find_module()
gw0 ok / gw1 ok / gw2 ok / gw3 ok / gw4 ok / gw5 C / gw6 C / gw7 C<frozen importlib._bootstrap>:914: ImportWarning: _AnsibleCollectionFinder.find_spec() not found; falling back to find_module()
gw0 ok / gw1 ok / gw2 ok / gw3 ok / gw4 ok / gw5 ok / gw6 C / gw7 C<frozen importlib._bootstrap>:914: ImportWarning: _AnsibleCollectionFinder.find_spec() not found; falling back to find_module()
gw0 ok / gw1 ok / gw2 ok / gw3 ok / gw4 ok / gw5 ok / gw6 ok / gw7 C<frozen importlib._bootstrap>:914: ImportWarning: _AnsibleCollectionFinder.find_spec() not found; falling back to find_module()
gw0 [1] / gw1 [1] / gw2 [1] / gw3 [1] / gw4 [1] / gw5 [1] / gw6 [1] / gw7 [1]
. [100%]
-------------------------- generated xml file: /Users/ssbarnea/c/a/ansible-lint/.test-results/pytest/results.xml ---------------------------
=========================================================== slowest 10 durations ===========================================================
(3 durations < 0.005s hidden. Use -vv to show these durations.)
============================================================ 1 passed in 8.52s =============================================================
pytest -k test_unjinja 48.61s user 4.44s system 449% cpu 11.793 total
Run with xdist disabled
$ pytest -n0 -k test_unjinja
<frozen importlib._bootstrap>:914: ImportWarning: _AnsibleCollectionFinder.find_spec() not found; falling back to find_module()
=========================================================== test session starts ============================================================
platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /Users/ssbarnea/c/a/ansible-lint, configfile: pytest.ini
plugins: markdown-1.0.2, flaky-3.7.0, mock-3.6.1, xdist-2.4.0, plus-0.2, forked-1.3.0, cov-3.0.0
collected 415 items / 414 deselected / 1 selected
run-last-failure: no previously failed tests, not deselecting items.
test/TestAnsibleLintRule.py . [100%]
-------------------------- generated xml file: /Users/ssbarnea/c/a/ansible-lint/.test-results/pytest/results.xml ---------------------------
=========================================================== slowest 10 durations ===========================================================
(3 durations < 0.005s hidden. Use -vv to show these durations.)
==================================================== 1 passed, 414 deselected in 1.55s =====================================================
Related: #338