1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #34787 -- Fixed autoreloader crash when run from installed script on Windows.

This commit is contained in:
sarahboyce
2023-08-26 16:23:19 +02:00
committed by Mariusz Felisiak
parent 24f1a38b37
commit f6ed2c36dd
2 changed files with 13 additions and 2 deletions

View File

@@ -238,6 +238,17 @@ class TestChildArguments(SimpleTestCase):
autoreload.get_child_arguments(), [exe_path, "runserver"]
)
@mock.patch("sys.warnoptions", [])
@mock.patch.dict(sys.modules, {"__main__": django.__main__})
def test_use_exe_when_main_spec(self):
with tempfile.TemporaryDirectory() as tmpdir:
exe_path = Path(tmpdir) / "django-admin.exe"
exe_path.touch()
with mock.patch("sys.argv", [exe_path.with_suffix(""), "runserver"]):
self.assertEqual(
autoreload.get_child_arguments(), [exe_path, "runserver"]
)
@mock.patch("__main__.__spec__", None)
@mock.patch("sys.warnoptions", [])
@mock.patch("sys._xoptions", {})