From 015517cd710965c1f7507dd403550d015fddc015 Mon Sep 17 00:00:00 2001 From: clement rouault Date: Mon, 24 May 2021 15:13:30 +0200 Subject: [PATCH] Fixed tests for new import windows.pipe requirement --- tests/test_handle.py | 3 ++- tests/test_pipe.py | 4 ++-- tests/test_process.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_handle.py b/tests/test_handle.py index a3c4e18..0004aeb 100644 --- a/tests/test_handle.py +++ b/tests/test_handle.py @@ -1,4 +1,5 @@ import windows +import windows.pipe def test_handle_process_id(): handle_with_process = [h for h in windows.system.handles if h.dwProcessId] @@ -20,7 +21,7 @@ TEST_FILE_FOR_HANDLE = r"C:\Windows\explorer.exe" def test_remote_handle_type_and_name(proc32_64): # tmpfile - proc32_64.execute_python("import windows") + proc32_64.execute_python("import windows; import windows.pipe") # A filename that a normal process should not have a handle on (to be sur) proc32_64.execute_python(r"""f = open(r"{filename}")""".format(filename=TEST_FILE_FOR_HANDLE)) proc32_64.execute_python(r"""h = windows.utils.get_handle_from_file(f)""") diff --git a/tests/test_pipe.py b/tests/test_pipe.py index 25af0a4..63dee80 100644 --- a/tests/test_pipe.py +++ b/tests/test_pipe.py @@ -6,7 +6,7 @@ import time PIPE_NAME = "PFW_Test_Pipe" rcode_test_ipc_pipe = """ -import windows +import windows; import windows.pipe windows.pipe.send_object("{pipe}", {{'Hello': 2}}) """ @@ -20,7 +20,7 @@ def test_ipc_pipe(proc32_64): rcode_test_echo_pipe = """ -import windows +import windows; import windows.pipe with windows.pipe.create("{pipe}") as np: np.wait_connection() diff --git a/tests/test_process.py b/tests/test_process.py index 317bf8d..58c8e7d 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -8,6 +8,7 @@ import textwrap import shutil import windows +import windows.pipe import windows.generated_def as gdef import windows.native_exec.simple_x86 as x86 import windows.native_exec.simple_x64 as x64 @@ -169,7 +170,7 @@ class TestProcessWithCheckGarbage(object): def test_execute_python_good_version(self, proc32_64): PIPE_NAME = "PFW_TEST_Pipe" - rcode = r"""import sys; import windows; windows.pipe.send_object("{pipe}", list(sys.version_info))""" + rcode = r"""import sys; import windows; import windows.pipe; windows.pipe.send_object("{pipe}", list(sys.version_info))""" with windows.pipe.create(PIPE_NAME) as np: proc32_64.execute_python(rcode.format(pipe=PIPE_NAME))