diff options
| author | Moriyoshi Koizumi <mozo@mozo.jp> | 2021-04-25 11:52:18 +0900 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-05-26 12:29:43 +0200 |
| commit | 9e4780dedac15adcc04309d0198f4ae34e04cc2a (patch) | |
| tree | dea939b75ae188ca4f2f200969a2619e0c3297b1 /tests/utils_tests/test_autoreload.py | |
| parent | 5a8e8f80bb82a867eab7e4d9d099f21d0a976d22 (diff) | |
Fixed #32669 -- Fixed detection when started non-django modules which aren't packages with "python -m" in autoreloader.
Diffstat (limited to 'tests/utils_tests/test_autoreload.py')
| -rw-r--r-- | tests/utils_tests/test_autoreload.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py index 7b91686bf5..af439d8b18 100644 --- a/tests/utils_tests/test_autoreload.py +++ b/tests/utils_tests/test_autoreload.py @@ -23,7 +23,7 @@ from django.test.utils import extend_sys_path from django.utils import autoreload from django.utils.autoreload import WatchmanUnavailable -from .test_module import __main__ as test_main +from .test_module import __main__ as test_main, main_module as test_main_module from .utils import on_macos_with_hfs @@ -182,6 +182,15 @@ class TestChildArguments(SimpleTestCase): [sys.executable, '-m', 'utils_tests.test_module', 'runserver'], ) + @mock.patch.dict(sys.modules, {'__main__': test_main_module}) + @mock.patch('sys.argv', [test_main.__file__, 'runserver']) + @mock.patch('sys.warnoptions', []) + def test_run_as_non_django_module_non_package(self): + self.assertEqual( + autoreload.get_child_arguments(), + [sys.executable, '-m', 'utils_tests.test_module.main_module', 'runserver'], + ) + @mock.patch('sys.argv', [__file__, 'runserver']) @mock.patch('sys.warnoptions', ['error']) def test_warnoptions(self): |
