mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-17 16:50:53 +00:00
- Added `dispatcharr.settings_test` for isolated testing, automatically creating an empty PostgreSQL test database and ensuring transaction isolation during tests. - Updated `manage.py` to switch to the test settings when running tests. - Enhanced the CONTRIBUTING.md file with detailed instructions on running the backend test suite and handling Celery tasks in tests. - Refactored test cases to use static methods for `worker_id` in `test_process_label.py` and adjusted assertions in `test_user_preferences.py` for better clarity and correctness.
24 lines
884 B
Python
24 lines
884 B
Python
#!/usr/bin/env python
|
|
"""Django's command-line utility for administrative tasks."""
|
|
import os
|
|
import sys
|
|
|
|
def main():
|
|
"""Run administrative tasks."""
|
|
# Use isolated test DB settings for `manage.py test` (empty test_<dbname>).
|
|
# Override with --settings=... on the command line if needed.
|
|
if len(sys.argv) > 1 and sys.argv[1] == "test":
|
|
os.environ["DJANGO_SETTINGS_MODULE"] = "dispatcharr.settings_test"
|
|
else:
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dispatcharr.settings")
|
|
try:
|
|
from django.core.management import execute_from_command_line
|
|
except ImportError as exc:
|
|
raise ImportError(
|
|
"Couldn't import Django. Make sure it's installed and "
|
|
"available on your PYTHONPATH environment variable."
|
|
) from exc
|
|
execute_from_command_line(sys.argv)
|
|
|
|
if __name__ == '__main__':
|
|
main()
|