Closed
Description
openedon Jun 22, 2023
Running python -m unittest tests/test_integration.py
gives this error
root@snekbox_dev:/snekbox# while true; do python -m unittest tests/test_integration.py; done
/root/.local/lib/python3.11/site-packages/falcon/media/__init__.py:4: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
from .handlers import Handlers
2023-06-22 11:59:55,203 | 8983 | gunicorn.error | ERROR | Exception in worker process
Traceback (most recent call last):
File "/root/.local/lib/python3.11/site-packages/gunicorn/util.py", line 359, in import_app
mod = importlib.import_module(module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tests/test_integration'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/.local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
worker.init_process()
File "/root/.local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process
self.load_wsgi()
File "/root/.local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
self.wsgi = self.app.wsgi()
^^^^^^^^^^^^^^^
File "/root/.local/lib/python3.11/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
^^^^^^^^^^^
File "/root/.local/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
return self.load_wsgiapp()
^^^^^^^^^^^^^^^^^^^
File "/root/.local/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
return util.import_app(self.app_uri)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/lib/python3.11/site-packages/gunicorn/util.py", line 363, in import_app
raise ImportError(msg % (module.rsplit(".", 1)[0], obj))
ImportError: Failed to find application, did you mean 'tests/test_integration:application'?
The issue is that the gunicorn process is inheriting the command line arguments used to run the tests and attempting to use them itself. I think setting sys.argv = [""]
in the subprocess is the easiest fix (a bit hacky but it seems to work fine)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment