Skip to content

Instantly share code, notes, and snippets.

@guyjacks
Created December 17, 2018 07:16
Show Gist options
  • Save guyjacks/53d14a9fe92c1de8b87f6bf77b635543 to your computer and use it in GitHub Desktop.
Save guyjacks/53d14a9fe92c1de8b87f6bf77b635543 to your computer and use it in GitHub Desktop.
Tried: docker-compose run --rm web py.test
WARNING: The DJANGO_CORS_ORIGIN_WHITELIST variable is not set. Defaulting to a blank string.
Starting one_raft_conventions_backend_postgres_1 ... done
============================================================================ test session starts ============================================================================
platform linux -- Python 3.7.0, pytest-4.0.2, py-1.7.0, pluggy-0.8.0
Django settings: config.settings.test (from ini file)
rootdir: /code, inifile: pytest.ini
plugins: mock-1.10.0, django-3.4.4, cov-2.6.0
collected 3 items / 1 errors
================================================================================== ERRORS ===================================================================================
___________________________________________________________ ERROR collecting api/conventions/tests/test_models.py ___________________________________________________________
ImportError while importing test module '/code/api/conventions/tests/test_models.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
ModuleNotFoundError: No module named 'api.conventions.tests.test_models'; 'api.conventions.tests' is not a package
I also tried: docker-compose run --rm web ./manage.py test
WARNING: The DJANGO_CORS_ORIGIN_WHITELIST variable is not set. Defaulting to a blank string.
Starting one_raft_conventions_backend_postgres_1 ... done
Traceback (most recent call last):
File "./manage.py", line 24, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/test.py", line 26, in run_from_argv
super().run_from_argv(argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/test.py", line 56, in handle
failures = test_runner.run_tests(test_labels)
File "/usr/local/lib/python3.7/site-packages/django/test/runner.py", line 603, in run_tests
suite = self.build_suite(test_labels, extra_tests)
File "/usr/local/lib/python3.7/site-packages/django/test/runner.py", line 514, in build_suite
tests = self.test_loader.discover(start_dir=label, **kwargs)
File "/usr/local/lib/python3.7/unittest/loader.py", line 347, in discover
tests = list(self._find_tests(start_dir, pattern))
File "/usr/local/lib/python3.7/unittest/loader.py", line 412, in _find_tests
yield from self._find_tests(full_path, pattern, namespace)
File "/usr/local/lib/python3.7/unittest/loader.py", line 412, in _find_tests
yield from self._find_tests(full_path, pattern, namespace)
File "/usr/local/lib/python3.7/unittest/loader.py", line 404, in _find_tests
full_path, pattern, namespace)
File "/usr/local/lib/python3.7/unittest/loader.py", line 457, in _find_test_path
msg % (mod_name, module_dir, expected_dir))
ImportError: 'tests' module incorrectly imported from '/code/api/conventions/tests'. Expected '/code/api/conventions'. Is this module globally installed?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment