django-otp / django-otp-yubikey

A django-otp plugin that verifies YubiKey OTP tokens.
The Unlicense
13 stars 4 forks source link

Cannot run tests #4

Closed moggers87 closed 4 years ago

moggers87 commented 4 years ago

Tests don't work, they appear to be loading django_otp's tests which causes issues. For example:

$ tox -e py37-django22
GLOB sdist-make: /home/moggers/workspace/django-otp-yubikey/setup.py
py37-django22 create: /home/moggers/workspace/django-otp-yubikey/.tox/py37-django22
py37-django22 installdeps: mock ; python_version < "3.0", Django==2.2.*
py37-django22 inst: /home/moggers/workspace/django-otp-yubikey/.tox/.tmp/package/1/django-otp-yubikey-0.5.2.zip
py37-django22 installed: Django==2.2.14,django-otp==0.9.3,django-otp-yubikey==0.5.2,pycryptodome==3.9.8,pytz==2020.1,six==1.15.0,sqlparse==0.3.1,YubiOTP==0.2.2.post1
py37-django22 run-test-pre: PYTHONHASHSEED='3091691227'
py37-django22 run-test: commands[0] | /home/moggers/workspace/django-otp-yubikey/.tox/py37-django22/bin/django-admin test otp_yubikey
System check identified no issues (0 silenced).
E
======================================================================
ERROR: otp_yubikey.tests (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: otp_yubikey.tests
Traceback (most recent call last):
  File "/usr/lib64/python3.7/unittest/loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib64/python3.7/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/home/moggers/workspace/django-otp-yubikey/.tox/py37-django22/lib/python3.7/site-packages/otp_yubikey/tests.py", line 7, in <module>
    from django_otp.tests import TestCase
  File "/home/moggers/workspace/django-otp-yubikey/.tox/py37-django22/lib/python3.7/site-packages/django_otp/tests.py", line 6, in <module>
    from freezegun import freeze_time
ModuleNotFoundError: No module named 'freezegun'

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

Adding freezegun to the list of dependencies in tox.ini mollifies Django's test runner, but Python 2.7 tests then fail because django_otp no longer support Python 2.7.