From 530ac84231fa0d6142284195604c0a657c2da5ac Mon Sep 17 00:00:00 2001 From: Fabio Zadrozny Date: Sun, 14 Apr 2024 09:55:03 -0300 Subject: [PATCH] Do django.setup() when running django unit-tests. --- .../pysrc/_pydev_runfiles/pydev_runfiles.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/org.python.pydev.core/pysrc/_pydev_runfiles/pydev_runfiles.py b/plugins/org.python.pydev.core/pysrc/_pydev_runfiles/pydev_runfiles.py index 2137efb9da..ca786c376b 100644 --- a/plugins/org.python.pydev.core/pysrc/_pydev_runfiles/pydev_runfiles.py +++ b/plugins/org.python.pydev.core/pysrc/_pydev_runfiles/pydev_runfiles.py @@ -748,6 +748,11 @@ def run_tests(self, handle_coverage=True): sys.stdout.write("done.\n") sys.stdout.write("Importing test modules ... ") + if self.configuration.django: + import django + if hasattr(django, 'setup'): + django.setup() + if handle_coverage: coverage_files, coverage = start_coverage_support(self.configuration)