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

Inconsistent test count depending on discovery method #508

Open
terjekv opened this issue May 30, 2023 · 0 comments
Open

Inconsistent test count depending on discovery method #508

terjekv opened this issue May 30, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@terjekv
Copy link
Collaborator

terjekv commented May 30, 2023

Different ways of calling pytest or using python manage.py test leads to different test counts being reported. Note that with parallel testing the warnings are not collated, so we get a nice multiple of them. This is to be expected.

$ find mreg* hostpolicy -iname '*test*' |grep -v __pycache__
mreg/api/v1/tests
mreg/api/v1/tests/test_txts.py
mreg/api/v1/tests/test_host_permissions.py
mreg/api/v1/tests/test_srvs.py
mreg/api/v1/tests/test_zonefile.py
mreg/api/v1/tests/tests_zones.py
mreg/api/v1/tests/test_hostgroups.py
mreg/api/v1/tests/test_labels.py
mreg/api/v1/tests/test_nameservers.py
mreg/api/v1/tests/test_networks.py
mreg/api/v1/tests/tests.py
mreg/api/v1/tests/tests_bacnet.py
mreg/api/v1/tests/test_history.py
mreg/api/v1/tests/test_permissions.py
mreg/tests.py
hostpolicy/api/v1/tests.py
hostpolicy/tests.py
$ pytest -n 6 -vv -s $( find mreg* hostpolicy -iname '*test*' |grep -v __pycache__ )
[...]
==== 1038 passed, 4 skipped, 51 warnings in 112.95s (0:01:52) ====
$ pytest -n 12 mreg/api/v1/tests mreg/tests.py hostpolicy/tests.py hostpolicy/api/v1/tests.py
[...]
==== 368 passed, 89 warnings in 35.81s ====
# Just to show that xdist/parallel makes no difference for the test count
$ pytest -n 4 mreg/api/v1/tests mreg/tests.py hostpolicy/tests.py hostpolicy/api/v1/tests.py
[...]
==== 368 passed, 33 warnings in 58.44s ====
$ coverage run manage.py test && coverage report -m
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
...........................................................................................................................................................................................................................................................................................................................................................................................................s......................................................s.......................................................................................................................................................
----------------------------------------------------------------------
Ran 602 tests in 357.215s
$ python3 -m unittest discover 2>&1 | grep 'unittest.loader._' | awk '{print $2}'
hostpolicy.api.v1.tests
hostpolicy.tests
mreg.api.v1.tests.test_history
mreg.api.v1.tests.test_host_permissions
mreg.api.v1.tests.test_hostgroups
mreg.api.v1.tests.test_labels
mreg.api.v1.tests.test_nameservers
mreg.api.v1.tests.test_networks
mreg.api.v1.tests.test_permissions
mreg.api.v1.tests.test_srvs
mreg.api.v1.tests.test_txts
mreg.api.v1.tests.test_zonefile
mreg.api.v1.tests.tests
mreg.api.v1.tests.tests_bacnet
mreg.api.v1.tests.tests_zones
mreg.tests

All in all, fairly inconsistent. Ideally, we should support either way of doing testing, especially when it comes to parallelisation.

@terjekv terjekv added the bug Something isn't working label May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant