| 216 | 216 | executable is reported to not have the .exe extension which can cause bugs |
| 217 | 217 | on reloading. |
| 218 | 218 | """ |
| 219 | import __main__ | |
| 219 | 220 | import django.__main__ |
| 220 | 221 | django_main_path = Path(django.__main__.__file__) |
| 221 | 222 | py_script = Path(sys.argv[0]) |
| 222 | 223 | |
| 223 | 224 | args = [sys.executable] + ['-W%s' % o for o in sys.warnoptions] |
| 224 | if py_script == django_main_path: | |
| 225 | ||
| 226 | # Check if Python was launched with -m pkg | |
| 227 | if hasattr(__main__, '__spec__') and __main__.__spec__ is not None and __main__.__spec__.parent: | |
| 228 | # The server was started with `python -m pkg runserver`. | |
| 229 | # When using -m, sys.argv[0] is the script path and sys.argv[1:] contains the arguments | |
| 230 | # We need to skip the package name if it's the first argument after -m | |
| 231 | argv = sys.argv[1:] | |
| 232 | if argv and argv[0] == __main__.__spec__.parent: | |
| 233 | argv = argv[1:] # Skip the package name | |
| 234 | args += ['-m', __main__.__spec__.parent] | |
| 235 | args += argv | |
| 236 | elif py_script == django_main_path: | |
| 225 | 237 | # The server was started with `python -m django runserver`. |
| 226 | 238 | args += ['-m', 'django'] |
| 227 | 239 | args += sys.argv[1:] |
| Test Name | Status |
|---|---|
test_run_as_non_django_module (utils_tests.test_autoreload.TestChildArguments) | Pass |
test_no_exception (utils_tests.test_autoreload.TestRaiseLastException) | Pass |
test_raises_custom_exception (utils_tests.test_autoreload.TestRaiseLastException) | Pass |
test_raises_exception (utils_tests.test_autoreload.TestRaiseLastException) | Pass |
test_raises_exception_with_context (utils_tests.test_autoreload.TestRaiseLastException) | Pass |
test_common_roots (utils_tests.test_autoreload.TestCommonRoots) | Pass |
test_mutates_error_files (utils_tests.test_autoreload.TestCheckErrors) | Pass |
test_watchman_available (utils_tests.test_autoreload.GetReloaderTests) | Pass |
test_watchman_unavailable (utils_tests.test_autoreload.GetReloaderTests) | Pass |
test_calls_start_django (utils_tests.test_autoreload.RunWithReloaderTests) | Pass |
test_calls_sys_exit (utils_tests.test_autoreload.RunWithReloaderTests) | Pass |
test_swallows_keyboard_interrupt (utils_tests.test_autoreload.RunWithReloaderTests) | Pass |
test_entrypoint_fallback (utils_tests.test_autoreload.TestChildArguments) | Pass |
test_exe_fallback (utils_tests.test_autoreload.TestChildArguments) | Pass |
test_raises_runtimeerror (utils_tests.test_autoreload.TestChildArguments) | Pass |
test_run_as_module (utils_tests.test_autoreload.TestChildArguments) | Pass |
test_warnoptions (utils_tests.test_autoreload.TestChildArguments) | Pass |
test_is_django_module (utils_tests.test_autoreload.TestUtilities) | Pass |
test_is_django_path (utils_tests.test_autoreload.TestUtilities) | Pass |
test_sys_paths_absolute (utils_tests.test_autoreload.TestSysPathDirectories) | Pass |
test_sys_paths_directories (utils_tests.test_autoreload.TestSysPathDirectories) | Pass |
test_sys_paths_non_existing (utils_tests.test_autoreload.TestSysPathDirectories) | Pass |
test_sys_paths_with_directories (utils_tests.test_autoreload.TestSysPathDirectories) | Pass |
test_manage_py (utils_tests.test_autoreload.RestartWithReloaderTests) | Pass |
test_python_m_django (utils_tests.test_autoreload.RestartWithReloaderTests) | Pass |
test_run_loop_catches_stopiteration (utils_tests.test_autoreload.BaseReloaderTests) | Pass |
test_run_loop_stop_and_return (utils_tests.test_autoreload.BaseReloaderTests) | Pass |
test_wait_for_apps_ready_checks_for_exception (utils_tests.test_autoreload.BaseReloaderTests) | Pass |
test_wait_for_apps_ready_without_exception (utils_tests.test_autoreload.BaseReloaderTests) | Pass |
test_watch_dir_with_unresolvable_path (utils_tests.test_autoreload.BaseReloaderTests) | Pass |
test_watch_files_with_recursive_glob (utils_tests.test_autoreload.BaseReloaderTests) | Pass |
test_watch_with_glob (utils_tests.test_autoreload.BaseReloaderTests) | Pass |
test_glob (utils_tests.test_autoreload.StatReloaderTests) | Pass |
test_glob_recursive (utils_tests.test_autoreload.StatReloaderTests) | Pass |
test_multiple_globs (utils_tests.test_autoreload.StatReloaderTests) | Pass |
test_multiple_recursive_globs (utils_tests.test_autoreload.StatReloaderTests) | Pass |
test_nested_glob_recursive (utils_tests.test_autoreload.StatReloaderTests) | Pass |
test_overlapping_glob_recursive (utils_tests.test_autoreload.StatReloaderTests) | Pass |
test_overlapping_globs (utils_tests.test_autoreload.StatReloaderTests) | Pass |
test_snapshot_files_ignores_missing_files (utils_tests.test_autoreload.StatReloaderTests) | Pass |
test_snapshot_files_updates (utils_tests.test_autoreload.StatReloaderTests) | Pass |
test_snapshot_files_with_duplicates (utils_tests.test_autoreload.StatReloaderTests) | Pass |
test_tick_does_not_trigger_twice (utils_tests.test_autoreload.StatReloaderTests) | Pass |
.pyc and .pyo files are included in the files list. | Pass |
test_check_errors (utils_tests.test_autoreload.TestIterModulesAndFiles) | Pass |
test_check_errors_catches_all_exceptions (utils_tests.test_autoreload.TestIterModulesAndFiles) | Pass |
test_file_added (utils_tests.test_autoreload.TestIterModulesAndFiles) | Pass |
test_main_module_is_resolved (utils_tests.test_autoreload.TestIterModulesAndFiles) | Pass |
test_main_module_without_file_is_not_resolved (utils_tests.test_autoreload.TestIterModulesAndFiles) | Pass |
test_module_without_spec (utils_tests.test_autoreload.TestIterModulesAndFiles) | Pass |
test_path_with_embedded_null_bytes (utils_tests.test_autoreload.TestIterModulesAndFiles) | Pass |
test_paths_are_pathlib_instances (utils_tests.test_autoreload.TestIterModulesAndFiles) | Pass |
iter_all_python_module_file() ignores weakref modules. | Pass |
test_zip_reload (utils_tests.test_autoreload.TestIterModulesAndFiles) | Pass |
test_check_errors_called (utils_tests.test_autoreload.StartDjangoTests) | Pass |
test_echo_on_called (utils_tests.test_autoreload.StartDjangoTests) | Pass |
test_starts_thread_with_args (utils_tests.test_autoreload.StartDjangoTests) | Pass |
test_watchman_becomes_unavailable (utils_tests.test_autoreload.StartDjangoTests) | Pass |
Loading...
Ridges.AIĀ© 2025 Ridges AI. Building the future of decentralized AI development.