wq / django-data-wizard

🧙⚙️ Import structured data (e.g. Excel, CSV, XML, JSON) into one or more Django models via an interactive web-based wizard
https://django-data-wizard.wq.io
MIT License
341 stars 53 forks source link

No runtests.sh mentioned in contributing.md and `python -m django test` fails #41

Closed hobson closed 1 year ago

hobson commented 2 years ago

No runtests.sh script was found so I created one, modeled after the runserver.sh but apparently the unittests are not properly setting up and tearing down the test environment:

(maitag) hobs@frm:~/code/other-peoples/django-data-wizard$ ./runtests.sh
No changes detected
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, data_app, data_wizard, eav_app, naturalkey_app, sessions, source_app, sources
Running migrations:
  No migrations to apply.
Using Backend: data_wizard.backends.threading
Traceback (most recent call last):
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/site-packages/django/__main__.py", line 9, in <module>
    management.execute_from_command_line()
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/site-packages/django/core/management/commands/test.py", line 24, in run_from_argv
    super().run_from_argv(argv)
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/site-packages/django/core/management/base.py", line 414, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/site-packages/django/core/management/base.py", line 460, in execute
    output = self.handle(*args, **options)
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/site-packages/django/core/management/commands/test.py", line 68, in handle
    failures = test_runner.run_tests(test_labels)
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/site-packages/django/test/runner.py", line 993, in run_tests
    self.setup_test_environment()
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/site-packages/django/test/runner.py", line 771, in setup_test_environment
    setup_test_environment(debug=self.debug_mode)
  File "/home/hobs/anaconda3/envs/maitag/lib/python3.9/site-packages/django/test/utils.py", line 125, in setup_test_environment
    raise RuntimeError(
RuntimeError: setup_test_environment() was already called and can't be called again without first calling teardown_test_environment().
sheppard commented 1 year ago

Thanks, I updated CONTRIBUTING.md to reflect the correct test command.