Page MenuHomePhabricator

Striker has stack traces when running django test suite
Closed, ResolvedPublic

Description

On a fresh clone of labs/striker.git when running the test suite with tox -e py35 the suite passes but there are a few stacktraces emitted:

CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.
Traceback (most recent call last):
  File "/usr/lib/python3.5/logging/__init__.py", line 986, in emit
    msg = self.format(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 836, in format
    return fmt.format(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 576, in format
    s = self.formatMessage(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 545, in formatMessage
    return self._style.format(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 389, in format
    return self._fmt % record.__dict__
KeyError: 'request_id'
Call stack:
  File "manage.py", line 30, in <module>
    execute_from_command_line(sys.argv)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django/core/management/__init__.py", line 357, in execute
    django.setup()
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 985, in _gcd_import
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/hashar/projects/labs/striker/striker/labsauth/models.py", line 35, in <module>
    import mwoauth
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/mwoauth/__init__.py", line 3, in <module>
    from .handshaker import Handshaker
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/mwoauth/handshaker.py", line 39, in <module>
    from .functions import complete, identify, initiate
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/mwoauth/functions.py", line 39, in <module>
    import jwt
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/jwt/__init__.py", line 19, in <module>
    from .api_jwt import (
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/jwt/api_jwt.py", line 11, in <module>
    from .api_jws import PyJWS
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/jwt/api_jws.py", line 10, in <module>
    from .algorithms import (
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/jwt/algorithms.py", line 8, in <module>
    from .utils import (
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/jwt/utils.py", line 8, in <module>
    from cryptography.hazmat.primitives.asymmetric.utils import (
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 943, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 943, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 943, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 943, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/cryptography/__init__.py", line 47, in <module>
    stacklevel=2,
Message: '%s'
Arguments: ('/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/jwt/utils.py:8: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.\n  from cryptography.hazmat.primitives.asymmetric.utils import (\n',)
nosetests --all-modules --cover-html --cover-inclusive --cover-package=striker --detailed-errors --nocapture --nologcapture --verbosity=2 --with-doctest
Creating test database for alias 'default'...
lines=10,name=nose: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() 
Traceback (most recent call last):
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/plugins/manager.py", line 250, in __getattr__
    return self._proxies[call]
KeyError: 'loadTestsFromModule'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/logging/__init__.py", line 986, in emit
    msg = self.format(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 836, in format
    return fmt.format(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 576, in format
    s = self.formatMessage(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 545, in formatMessage
    return self._style.format(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 389, in format
    return self._fmt % record.__dict__
KeyError: 'request_id'
Call stack:
  File "manage.py", line 30, in <module>
    execute_from_command_line(sys.argv)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django/core/management/commands/test.py", line 23, in run_from_argv
    super().run_from_argv(argv)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django/core/management/commands/test.py", line 53, in handle
    failures = test_runner.run_tests(test_labels)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django_nose/runner.py", line 308, in run_tests
    result = self.run_suite(nose_argv)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django_nose/runner.py", line 245, in run_suite
    addplugins=plugins_to_add)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/core.py", line 121, in __init__
    **extra_args)
  File "/usr/lib/python3.5/unittest/main.py", line 95, in __init__
    self.runTests()
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/core.py", line 207, in runTests
    result = self.testRunner.run(self.test)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/core.py", line 50, in run
    wrapper = self.config.plugins.prepareTest(test)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/plugins/manager.py", line 99, in __call__
    return self.call(*arg, **kw)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/plugins/manager.py", line 167, in simple
    result = meth(*arg, **kw)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django_nose/plugin.py", line 260, in prepareTest
    test = self._put_transaction_test_cases_last(test)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django_nose/plugin.py", line 193, in _put_transaction_test_cases_last
    process_tests(test, flattened.append)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django_nose/utils.py", line 36, in process_tests
    process_tests(t, process)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/django_nose/utils.py", line 35, in process_tests
    for t in suite._tests:
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/suite.py", line 100, in _get_tests
    for test in self.test_generator:
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/loader.py", line 192, in loadTestsFromDir
    entry_path, discovered=True)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/loader.py", line 433, in loadTestsFromName
    discovered=discovered)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/loader.py", line 354, in loadTestsFromModule
    tests.extend(self.loadTestsFromDir(module_path))
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/loader.py", line 192, in loadTestsFromDir
    entry_path, discovered=True)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/loader.py", line 433, in loadTestsFromName
    discovered=discovered)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/loader.py", line 354, in loadTestsFromModule
    tests.extend(self.loadTestsFromDir(module_path))
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/loader.py", line 184, in loadTestsFromDir
    entry_path, discovered=True)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/loader.py", line 433, in loadTestsFromName
    discovered=discovered)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/loader.py", line 356, in loadTestsFromModule
    for test in self.config.plugins.loadTestsFromModule(module, path):
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/plugins/manager.py", line 252, in __getattr__
    proxy = self.proxyClass(call, self._plugins)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/plugins/manager.py", line 96, in __init__
    self.addPlugin(p, call)
  File "/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/plugins/manager.py", line 108, in addPlugin
    len(inspect.getargspec(meth)[0]) == 2:
  File "/usr/lib/python3.5/inspect.py", line 1046, in getargspec
    stacklevel=2)
Message: '%s'
Arguments: ('/home/hashar/projects/labs/striker/.tox/py35/lib/python3.5/site-packages/nose/plugins/manager.py:108: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead\n  len(inspect.getargspec(meth)[0]) == 2:\n',)

Event Timeline

Striker lists in requirements.txt: cryptography>=2.7 might want to have an upper limit.

tox is configured for python 3.5 which was in Stretch. If Striker got migrated to Buster that can be updated to python 3.7.

nose is deprecated and hasn't been updated since 2015. The community is moving to pytest. Maybe there is a way to mute the Deprecationwarning for inspect.getargspec() but overall it sounds saner to commit to migrate to pytest. Most probably the issue will hit us anyway in a future python 3 version.

bd808 triaged this task as Low priority.May 8 2022, 3:32 PM
bd808 moved this task from Backlog to Ready on the Striker board.
bd808 claimed this task.
bd808 subscribed.

This has been fixed as a side effect of moving to pipelinelib and updating dependencies.