diff options
author | Claude Paroz <claude@2xlibre.net> | 2019-08-23 10:53:36 +0200 |
---|---|---|
committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2019-08-23 10:53:36 +0200 |
commit | 9386586f31b8a0bccf59a1bff647cd829d4e79aa (patch) | |
tree | f28bf4c9b8b0a1431c1b6722f9d5bb613d78040f /tests/dbshell | |
parent | 7bd963332017eace00be8caf7dc1b7b304da613a (diff) | |
download | django-9386586f31b8a0bccf59a1bff647cd829d4e79aa.tar.gz |
Replaced subprocess commands by run() wherever possible.
Diffstat (limited to 'tests/dbshell')
-rw-r--r-- | tests/dbshell/test_oracle.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/dbshell/test_oracle.py b/tests/dbshell/test_oracle.py index d236a932ab..cfaf106d68 100644 --- a/tests/dbshell/test_oracle.py +++ b/tests/dbshell/test_oracle.py @@ -1,3 +1,4 @@ +from subprocess import CompletedProcess from unittest import mock, skipUnless from django.db import connection @@ -9,13 +10,13 @@ from django.test import SimpleTestCase class OracleDbshellTests(SimpleTestCase): def _run_dbshell(self, rlwrap=False): """Run runshell command and capture its arguments.""" - def _mock_subprocess_call(*args): - self.subprocess_args = tuple(*args) - return 0 + def _mock_subprocess_run(*args): + self.subprocess_args = list(*args) + return CompletedProcess(self.subprocess_args, 0) client = DatabaseClient(connection) self.subprocess_args = None - with mock.patch('subprocess.call', new=_mock_subprocess_call): + with mock.patch('subprocess.run', new=_mock_subprocess_run): with mock.patch('shutil.which', return_value='/usr/bin/rlwrap' if rlwrap else None): client.runshell() return self.subprocess_args |