mirror of https://github.com/django/django.git
[3.1.x] Used temporary directory in RestartWithReloaderTests.test_manage_py().
Using the current directory can cause a PermissionError.
Backport of 730711e828
from master
This commit is contained in:
parent
c7e95dea80
commit
b830cc02ed
|
@ -410,14 +410,17 @@ class RestartWithReloaderTests(SimpleTestCase):
|
||||||
return mock_call
|
return mock_call
|
||||||
|
|
||||||
def test_manage_py(self):
|
def test_manage_py(self):
|
||||||
script = Path('manage.py')
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
script.touch()
|
script = Path(temp_dir) / 'manage.py'
|
||||||
self.addCleanup(script.unlink)
|
script.touch()
|
||||||
argv = ['./manage.py', 'runserver']
|
argv = [script, 'runserver']
|
||||||
mock_call = self.patch_autoreload(argv)
|
mock_call = self.patch_autoreload(argv)
|
||||||
autoreload.restart_with_reloader()
|
autoreload.restart_with_reloader()
|
||||||
self.assertEqual(mock_call.call_count, 1)
|
self.assertEqual(mock_call.call_count, 1)
|
||||||
self.assertEqual(mock_call.call_args[0][0], [self.executable, '-Wall'] + argv)
|
self.assertEqual(
|
||||||
|
mock_call.call_args[0][0],
|
||||||
|
[self.executable, '-Wall'] + argv,
|
||||||
|
)
|
||||||
|
|
||||||
def test_python_m_django(self):
|
def test_python_m_django(self):
|
||||||
main = '/usr/lib/pythonX.Y/site-packages/django/__main__.py'
|
main = '/usr/lib/pythonX.Y/site-packages/django/__main__.py'
|
||||||
|
|
Loading…
Reference in New Issue