From 9386586f31b8a0bccf59a1bff647cd829d4e79aa Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Fri, 23 Aug 2019 10:53:36 +0200 Subject: Replaced subprocess commands by run() wherever possible. --- tests/dbshell/test_oracle.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/dbshell') 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 -- cgit v1.3