From dce06b3ce546dfd5a090233ef0a639c3c5ce6fe6 Mon Sep 17 00:00:00 2001 From: Tapple Date: Tue, 21 Feb 2023 11:29:22 -0500 Subject: unit tests can now be imported on windows --- tests/test_ctrl_chars.py | 5 +++-- tests/test_pxssh.py | 4 +++- tests/test_run.py | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/test_ctrl_chars.py b/tests/test_ctrl_chars.py index 0719fc7..11fb55c 100755 --- a/tests/test_ctrl_chars.py +++ b/tests/test_ctrl_chars.py @@ -26,8 +26,9 @@ from . import PexpectTestCase import time import sys -from ptyprocess import ptyprocess -ptyprocess._make_eof_intr() +if sys.platform != 'win32': + from ptyprocess import ptyprocess + ptyprocess._make_eof_intr() if sys.version_info[0] >= 3: def byte(i): diff --git a/tests/test_pxssh.py b/tests/test_pxssh.py index c6ec4e2..ba700c8 100644 --- a/tests/test_pxssh.py +++ b/tests/test_pxssh.py @@ -1,10 +1,12 @@ #!/usr/bin/env python +import sys import os import shutil import tempfile import unittest -from pexpect import pxssh +if sys.platform != 'win32': + from pexpect import pxssh from .PexpectTestCase import PexpectTestCase class SSHTestBase(PexpectTestCase): diff --git a/tests/test_run.py b/tests/test_run.py index baa6b49..15d0c40 100755 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -52,7 +52,8 @@ def function_events_callback(values): class RunFuncTestCase(PexpectTestCase.PexpectTestCase): - runfunc = staticmethod(pexpect.run) + if sys.platform != 'win32': + runfunc = staticmethod(pexpect.run) cr = b'\r' empty = b'' prep_subprocess_out = staticmethod(lambda x: x) @@ -160,7 +161,8 @@ class RunFuncTestCase(PexpectTestCase.PexpectTestCase): class RunUnicodeFuncTestCase(RunFuncTestCase): - runfunc = staticmethod(pexpect.runu) + if sys.platform != 'win32': + runfunc = staticmethod(pexpect.runu) cr = b'\r'.decode('ascii') empty = b''.decode('ascii') prep_subprocess_out = staticmethod(lambda x: x.decode('utf-8', 'replace')) -- cgit v1.2.1