Getting error while running tests.
Hey, I am getting this error while running this command:
python3 manage.py test apps
Traceback (most recent call last): File "/home/kriyanshi/mercury-2.3.7/mercury/manage.py", line 22, in
main() File "/home/kriyanshi/mercury-2.3.7/mercury/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/home/kriyanshi/mercury-2.3.7/menv/lib/python3.10/site-packages/django/core/management/init.py", line 442, in execute_from_command_line utility.execute() File "/home/kriyanshi/mercury-2.3.7/menv/lib/python3.10/site-packages/django/core/management/init.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/kriyanshi/mercury-2.3.7/menv/lib/python3.10/site-packages/django/core/management/commands/test.py", line 24, in run_from_argv super().run_from_argv(argv) File "/home/kriyanshi/mercury-2.3.7/menv/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv self.execute(*args, **cmd_options) File "/home/kriyanshi/mercury-2.3.7/menv/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute output = self.handle(*args, **options) File "/home/kriyanshi/mercury-2.3.7/menv/lib/python3.10/site-packages/django/core/management/commands/test.py", line 68, in handle failures = test_runner.run_tests(test_labels) File "/home/kriyanshi/mercury-2.3.7/menv/lib/python3.10/site-packages/django/test/runner.py", line 1048, in run_tests suite = self.build_suite(test_labels, extra_tests) File "/home/kriyanshi/mercury-2.3.7/menv/lib/python3.10/site-packages/django/test/runner.py", line 898, in build_suite tests = self.load_tests_for_label(label, discover_kwargs) File "/home/kriyanshi/mercury-2.3.7/menv/lib/python3.10/site-packages/django/test/runner.py", line 872, in load_tests_for_label tests = self.test_loader.discover(start_dir=label, **kwargs) File "/usr/lib/python3.10/unittest/loader.py", line 349, in discover tests = list(self._find_tests(start_dir, pattern)) File "/usr/lib/python3.10/unittest/loader.py", line 414, in _find_tests yield from self._find_tests(full_path, pattern, namespace) File "/usr/lib/python3.10/unittest/loader.py", line 405, in _find_tests tests, should_recurse = self._find_test_path( File "/usr/lib/python3.10/unittest/loader.py", line 458, in _find_test_path raise ImportError( ImportError: 'tests' module incorrectly imported from '/home/kriyanshi/mercury-2.3.7/mercury/apps/nb/tests'. Expected '/home/kriyanshi/mercury-2.3.7/mercury/apps/nb'. Is this module globally installed?
ImportError: 'tests' module incorrectly imported from '/home/runner/work/mercury/mercury/mercury/apps/nb/tests'. Expected '/home/runner/work/mercury/mercury/mercury/apps/nb'. Is this module globally installed?
I got this error while pushing changes to main branch.
Hi @kriyanshishah,
Hard to say what is the reason.
this is django error and its because the way tests are structured. here is the link: https://stackoverflow.com/questions/37525075/what-does-tests-module-incorrectly-imported-mean