[Twisted-Python] trial cant find my class, example from twisted docs
hi, up to now ive only used the python unittest for my code, but now i would also like to test the twisted part. so i followed: http://twistedmatrix.com/documents/current/core/howto/trial.html but i get this error: (venv) julius@t560:~/code/python/twisted/basics$ trial calculus calculus ... [ERROR] ======================================================================= ======== [ERROR] Traceback (most recent call last): File "/home/julius/code/python/twisted/basics/calculus/venv/lib/python3.5/si te-packages/twisted/trial/runner.py", line 781, in loadByName return self.suiteFactory([self.findByName(name, recurse=recurse)]) File "/home/julius/code/python/twisted/basics/calculus/venv/lib/python3.5/si te-packages/twisted/trial/runner.py", line 710, in findByName obj = reflect.namedAny(name) File "/home/julius/code/python/twisted/basics/calculus/venv/lib/python3.5/si te-packages/twisted/python/reflect.py", line 306, in namedAny raise ModuleNotFound("No module named %r" % (name,)) twisted.python.reflect.ModuleNotFound: No module named 'calculus' calculus --------------------------------------------------------------------- ---------- Ran 1 tests in 0.024s FAILED (errors=1) heres how my calculus directory looks like: find . | grep -v './venv/' . ./__pycache__ ./__pycache__/__init__.cpython-35.pyc ./test ./test/test_base_1.py ./test/__init__.py ./venv ./__init__.py ./base_1.py ./__init__.pyc venv contains the virtualenv created by "virtualenv -p /usr/bin/python3 venv" the __init__.py files are empty and test_base_1.py / base_1.py contains what is shown in the tutorial. any idea why this does not work?
Am Montag, den 20.02.2017, 18:16 -0800 schrieb Glyph Lefkowitz:
On Feb 20, 2017, at 5:02 AM, steven meiers
wrote: any idea why this does not work?
Most likely you are being bitten by the recent change to not add '.' to sys.path automatically.
Does `PYTHONPATH=. trial ...` run your code as expected?
Yes, thanks very much. this kind of change really makes one doubt ones abilities. Should i write a ticket for this? greetings
any idea why this does not work?
Most likely you are being bitten by the recent change to not add '.' to sys.path automatically.
Does `PYTHONPATH=. trial ...` run your code as expected?
Yes, thanks very much. this kind of change really makes one doubt ones abilities.
Should i write a ticket for this?
No, you should start installing your packages and applications in dev lest packaging errors come back in prod and bite you. :) More on that: https://hynek.me/articles/testing-packaging/
participants (3)
-
Glyph Lefkowitz
-
Hynek Schlawack
-
steven meiers