[pytest]
DJANGO_SETTINGS_MODULE = app.settings
python_files = tests.py test_*.py
addopts = -n4 --nomigrations --cov=. --cov-report=html --cov-report=term:skip-covered
$ pytest
============================= test session starts ==============================
platform linux -- Python 3.6.7, pytest-4.2.1, py-1.7.0, pluggy-0.8.1
Django settings: app.settings (from ini file)
rootdir: /builds/xxxxx/xxxxx, inifile: pytest.ini
plugins: xdist-1.26.1, forked-1.0.1, django-3.4.7, cov-2.6.1
gw0 I / gw1 I / gw2 I / gw3 I
gw0 [1] / gw1 [1] / gw2 [1] / gw3 [1]
. [100%]
==================================== ERRORS ====================================
_______________________ ERROR collecting app/__init__.py _______________________
/usr/local/lib/python3.6/site-packages/_pytest/runner.py:226: in from_call
result = func()
/usr/local/lib/python3.6/site-packages/_pytest/runner.py:289: in <lambda>
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/local/lib/python3.6/site-packages/_pytest/python.py:650: in collect
for x in self._collectfile(path):
/usr/local/lib/python3.6/site-packages/_pytest/python.py:602: in _collectfile
assert path.isfile()
E AssertionError
_______________________ ERROR collecting app/__init__.py _______________________
/usr/local/lib/python3.6/site-packages/_pytest/runner.py:226: in from_call
result = func()
/usr/local/lib/python3.6/site-packages/_pytest/runner.py:289: in <lambda>
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/local/lib/python3.6/site-packages/_pytest/python.py:650: in collect
for x in self._collectfile(path):
/usr/local/lib/python3.6/site-packages/_pytest/python.py:602: in _collectfile
assert path.isfile()
E AssertionError
_______________________ ERROR collecting app/__init__.py _______________________
/usr/local/lib/python3.6/site-packages/_pytest/runner.py:226: in from_call
result = func()
/usr/local/lib/python3.6/site-packages/_pytest/runner.py:289: in <lambda>
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/local/lib/python3.6/site-packages/_pytest/python.py:650: in collect
for x in self._collectfile(path):
/usr/local/lib/python3.6/site-packages/_pytest/python.py:602: in _collectfile
assert path.isfile()
E AssertionError
_______________________ ERROR collecting app/__init__.py _______________________
/usr/local/lib/python3.6/site-packages/_pytest/runner.py:226: in from_call
result = func()
/usr/local/lib/python3.6/site-packages/_pytest/runner.py:289: in <lambda>
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/local/lib/python3.6/site-packages/_pytest/python.py:650: in collect
for x in self._collectfile(path):
/usr/local/lib/python3.6/site-packages/_pytest/python.py:602: in _collectfile
assert path.isfile()
E AssertionError
----------- coverage: platform linux, python 3.6.7-final-0 -----------
Name Stmts Miss Cover
------------------------------------------
app/admin.py 62 11 82%
app/consumers.py 19 19 0%
app/data.py 1 1 0%
app/middleware.py 16 3 81%
app/mixins.py 23 11 52%
app/models.py 73 5 93%
app/redis_mockup.py 10 10 0%
app/routing.py 7 7 0%
app/storages.py 4 1 75%
app/tasks.py 24 15 38%
app/test_utils.py 19 19 0%
app/utils.py 4 4 0%
app/validators.py 22 8 64%
app/views.py 27 14 48%
manage.py 6 6 0%
membership/admin.py 58 24 59%
membership/forms.py 148 73 51%
membership/models.py 30 9 70%
membership/tasks.py 63 55 13%
membership/utils.py 25 15 40%
membership/views.py 129 73 43%
payment/admin.py 43 12 72%
payment/models.py 85 23 73%
payment/payu.py 64 64 0%
payment/tasks.py 37 37 0%
payment/utils.py 44 35 20%
payment/views.py 54 39 28%
tinnova/tinnova.py 96 68 29%
user/forms.py 31 31 0%
user/models.py 48 12 75%
user/views.py 9 9 0%
venue/admin.py 43 2 95%
venue/models.py 92 8 91%
venue/views.py 34 20 41%
------------------------------------------
TOTAL 1551 743 52%
28 files skipped due to complete coverage.
Coverage HTML written to dir htmlcov
====================== 1 passed, 4 error in 30.76 seconds ======================
ERROR: Job failed: exit code 1
Im using docker image python 3.6
Django==2.1.5
channels_redis==2.3.3
channels==2.1.7 # Updated from 2.1.6
coverage==4.5.2
gunicorn==19.9.0
huey==1.10.5 # Updated from 1.10.4
ipython==7.2.0
Pillow==5.4.1
piprot==0.9.10
prospector==1.1.6.2 # Updated from 1.1.5
psycopg2-binary==2.7.7 # Updated from 2.7.6.1
pytest-cov==2.6.1
pytest-xdist==1.26.1
pytest==4.2.0
python_magic==0.4.15
raven==6.10.0
requests==2.21.0
tblib==1.3.2
uvicorn==0.4.3 # Updated from 0.3.29
z3c.rml==3.6.1
dj-inmemorystorage==1.4.1
django-admin-sortable==2.1.11 # Updated from 2.1.9
django-axes==4.5.4
django-compressor==2.2
django-constance==2.3.1
django-debug-toolbar==1.11
django-dynamic-fixture==2.0.0
django-extensions==2.1.5 # Updated from 2.1.4
django-hashid-field==2.1.5
django-ipware==2.1.0
django-redis==4.10.0
django-widget-tweaks==1.4.3
pytest-django==3.4.7
Whats wrong?
Hi, I encountered the same problem today. While debugging I found the collection broke on a broken symlink that lives in our codebase (it's in a test data folder and used for testing purposes). This seems to have never been a problem before. When ignoring the specific data folder ("--ignore src/test/data" in our case) the tests ran nicely once again. But I'm not sure if this should be the behaviour.
@felipe3dfx
I assume this also happens without xdist? (use -n0)
Then you can/should also check what path is there - is it also a broken symlink?
When did this started to happen (consider using git-bisect with pytest)
@dorpvom
A single/simple broken symlink (ln -s test_broken_symlink.py test_broken.py) does not trigger it for me, so it must be something more complex, e.g. in a package etc. Can you provide a minimal test case?
Likely caused by https://github.com/pytest-dev/pytest/commit/913a2da6e52b6f2395b19c3163200726070b449d. Will look into a fix.
Most helpful comment
https://github.com/pytest-dev/pytest/pull/4784