From: Gordon Ball Date: Mon, 4 Jan 2021 11:57:24 +0000 Subject: tests: spawn python3 not python --- tests/test_performance.py | 10 +++++----- tests/test_pxssh.py | 2 +- tests/test_replwrap.py | 4 ++-- tests/test_run.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test_performance.py b/tests/test_performance.py index 63778af..e0c7df4 100755 --- a/tests/test_performance.py +++ b/tests/test_performance.py @@ -45,7 +45,7 @@ class PerformanceTestCase (PexpectTestCase.PexpectTestCase): return 'for n in range(1, %d+1): print(n)' % n def plain_range(self, n): - e = pexpect.spawn('python', timeout=100) + e = pexpect.spawn('python3', timeout=100) self.assertEqual(e.expect(b'>>>'), 0) e.sendline(self._iter_n(n)) self.assertEqual(e.expect(br'\.{3}'), 0) @@ -53,7 +53,7 @@ class PerformanceTestCase (PexpectTestCase.PexpectTestCase): self.assertEqual(e.expect([b'inquisition', '%d' % n]), 1) def window_range(self, n): - e = pexpect.spawn('python', timeout=100) + e = pexpect.spawn('python3', timeout=100) self.assertEqual(e.expect(b'>>>'), 0) e.sendline(self._iter_n(n)) self.assertEqual(e.expect(r'\.{3}'), 0) @@ -61,7 +61,7 @@ class PerformanceTestCase (PexpectTestCase.PexpectTestCase): self.assertEqual(e.expect([b'inquisition', '%d' % n], searchwindowsize=20), 1) def exact_range(self, n): - e = pexpect.spawn('python', timeout=100) + e = pexpect.spawn('python3', timeout=100) self.assertEqual(e.expect_exact([b'>>>']), 0) e.sendline(self._iter_n(n)) self.assertEqual(e.expect_exact([b'...']), 0) @@ -69,7 +69,7 @@ class PerformanceTestCase (PexpectTestCase.PexpectTestCase): self.assertEqual(e.expect_exact([b'inquisition', '%d' % n],timeout=520), 1) def ewin_range(self, n): - e = pexpect.spawn('python', timeout=100) + e = pexpect.spawn('python3', timeout=100) self.assertEqual(e.expect_exact([b'>>>']), 0) e.sendline(self._iter_n(n)) self.assertEqual(e.expect_exact([b'...']), 0) @@ -77,7 +77,7 @@ class PerformanceTestCase (PexpectTestCase.PexpectTestCase): self.assertEqual(e.expect_exact([b'inquisition', '%d' % n], searchwindowsize=20), 1) def faster_range(self, n): - e = pexpect.spawn('python', timeout=100) + e = pexpect.spawn('python3', timeout=100) self.assertEqual(e.expect(b'>>>'), 0) e.sendline(('list(range(1, %d+1))' % n).encode('ascii')) self.assertEqual(e.expect([b'inquisition', '%d' % n]), 1) diff --git a/tests/test_pxssh.py b/tests/test_pxssh.py index c6ec4e2..106b2b5 100644 --- a/tests/test_pxssh.py +++ b/tests/test_pxssh.py @@ -12,7 +12,7 @@ class SSHTestBase(PexpectTestCase): super(SSHTestBase, self).setUp() self.tempdir = tempfile.mkdtemp() self.orig_path = os.environ.get('PATH') - os.symlink(self.PYTHONBIN, os.path.join(self.tempdir, 'python')) + os.symlink(self.PYTHONBIN, os.path.join(self.tempdir, 'python3')) fakessh_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'fakessh')) os.environ['PATH'] = self.tempdir + os.pathsep + fakessh_dir + \ ((os.pathsep + self.orig_path) if self.orig_path else '') diff --git a/tests/test_replwrap.py b/tests/test_replwrap.py index 06ca07b..31898dd 100644 --- a/tests/test_replwrap.py +++ b/tests/test_replwrap.py @@ -97,7 +97,7 @@ class REPLWrapTestCase(unittest.TestCase): if platform.python_implementation() == 'PyPy': raise unittest.SkipTest(skip_pypy) - p = replwrap.python() + p = replwrap.python(command="python3") res = p.run_command('4+7') assert res.strip() == '11' @@ -108,7 +108,7 @@ class REPLWrapTestCase(unittest.TestCase): if platform.python_implementation() == 'PyPy': raise unittest.SkipTest(skip_pypy) - child = pexpect.spawn('python', echo=False, timeout=5, encoding='utf-8') + child = pexpect.spawn('python3', echo=False, timeout=5, encoding='utf-8') # prompt_change=None should mean no prompt change py = replwrap.REPLWrapper(child, u">>> ", prompt_change=None, continuation_prompt=u"... ") diff --git a/tests/test_run.py b/tests/test_run.py index 401ddc6..443c979 100755 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -69,8 +69,8 @@ class RunFuncTestCase(PexpectTestCase.PexpectTestCase): super(RunFuncTestCase, self).tearDown() def test_run_exit(self): - (data, exitstatus) = self.runfunc('python exit1.py', withexitstatus=1) - assert exitstatus == 1, "Exit status of 'python exit1.py' should be 1." + (data, exitstatus) = self.runfunc('python3 exit1.py', withexitstatus=1) + assert exitstatus == 1, "Exit status of 'python3 exit1.py' should be 1." def test_run(self): the_old_way = subprocess.Popen(