Fixed #32202 -- Fixed autoreloader argument generation for Windows with Python 3.7-.

This commit is contained in:
Carlton Gibson 2020-11-19 12:07:15 +01:00 committed by GitHub
parent 9f72b0970d
commit ead37dfb58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 7 deletions

View file

@ -178,10 +178,10 @@ class TestChildArguments(SimpleTestCase):
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']):
with mock.patch('sys.argv', [str(exe_path.with_suffix('')), 'runserver']):
self.assertEqual(
autoreload.get_child_arguments(),
[exe_path, 'runserver']
[str(exe_path), 'runserver']
)
@mock.patch('sys.warnoptions', [])
@ -189,10 +189,10 @@ class TestChildArguments(SimpleTestCase):
with tempfile.TemporaryDirectory() as tmpdir:
script_path = Path(tmpdir) / 'django-admin-script.py'
script_path.touch()
with mock.patch('sys.argv', [script_path.with_name('django-admin'), 'runserver']):
with mock.patch('sys.argv', [str(script_path.with_name('django-admin')), 'runserver']):
self.assertEqual(
autoreload.get_child_arguments(),
[sys.executable, script_path, 'runserver']
[sys.executable, str(script_path), 'runserver']
)
@mock.patch('sys.argv', ['does-not-exist', 'runserver'])
@ -433,7 +433,7 @@ class RestartWithReloaderTests(SimpleTestCase):
with tempfile.TemporaryDirectory() as temp_dir:
script = Path(temp_dir) / 'manage.py'
script.touch()
argv = [script, 'runserver']
argv = [str(script), 'runserver']
mock_call = self.patch_autoreload(argv)
autoreload.restart_with_reloader()
self.assertEqual(mock_call.call_count, 1)