Pytest hangs forever with Github Actions
See original GitHub issueAfter collecting the items, it hangs until Github’s timeout. Example there: https://github.com/Mulugruntz/celery-pubsub/runs/2668823507?check_suite_focus=true#step:7:22
What is weird is that on another project, setup in a very similar (but not same) way, it works fine: https://github.com/Mulugruntz/aiosubprocess/runs/2665341529?check_suite_focus=true#step:7:50
On my local, it works (famous words… 🙄 )
on local
coverage run -m pytest tests && coverage report && coverage xml
========================================= test session starts ==========================================
platform darwin -- Python 2.7.16, pytest-4.6.11, py-1.10.0, pluggy-0.13.1
rootdir: /Users/sgiffard/PycharmProjects/celery-pubsub, inifile: pytest.ini, testpaths: tests
collected 10 items
tests/test_pubsub.py .......... [100%]
====================================== slowest 10 test durations =======================================
0.01s call tests/test_pubsub.py::test_subscription
(0.00 durations hidden. Use -vv to show these durations.)
====================================== 10 passed in 0.10 seconds =======================================
Name Stmts Miss Branch BrPart Cover
-------------------------------------------------------------
celery_pubsub/__init__.py 2 0 0 0 100%
celery_pubsub/pubsub.py 47 0 10 0 100%
tests/__init__.py 0 0 0 0 100%
tests/conftest.py 49 0 0 0 100%
tests/test_pubsub.py 62 0 0 0 100%
-------------------------------------------------------------
TOTAL 160 0 10 0 100%
on Github Actions (first link, above)
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.10.0, pluggy-0.13.1
rootdir: /home/runner/work/celery-pubsub/celery-pubsub, inifile: pytest.ini, testpaths: tests
plugins: celery-4.4.7
collected 10 items
Only Python version is different (but minor). And it’s on python 2.7 for the example but it also fails on all the other tested versions (cpython 2.7, 3.6, 3.7, 3.8 and pypy 2.7, 3.6, 3.7).
It looks like a bug. Not sure where. Maybe Github Actions, maybe pytest?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Test hangs forever with a specific exception chain · Issue #3804
When running a test that raises an Exception with a loop in the __causes__ variable (by using raise A from B), pytest hangs...
Read more >pytest hangs in Docker · Discussion #6349 - GitHub
pytest hangs in Docker. ... And it hangs there forever. ... With Github Actions (which use Docker), pytests hangs at a specific test...
Read more >pytest runs forever · Issue #9466 - GitHub
I'm working on a django channel project, i did more than 10 tests it works fine, but the last one is running forever....
Read more >pytest hangs after tests finish running · Issue #7250 - GitHub
The test setup that I have needs to connect to boards to be able to run tests. For this purpose, I wrote a...
Read more >Test process hanging forever · Issue #43 · pytest-dev/execnet
We have a test job that uses pytest, xdist, execnet and it has been hanging forever on a regular basis. Attaching in gdb...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I also faced the same issue but I found out the root cause is due to Django version. I was using Django 3.1.12 with two databases aliases like below.
Occasionally, Django will use the second connection to create the test database and I believe it messed up the test setup and caused my Github Actions to stuck after “Collected xx items” This bug is resolved at https://github.com/django/django/pull/13507/files with Django 3.2 version, haven’t encountered this issue since I upgraded Django to 3.2. Hope you find this comment helpful !
@em1208 No, I had some other stuffs to take care of. I haven’t been able to fix it yet.