diff --git a/tests/workers/conftest.py b/tests/workers/conftest.py index edaafa17..87bc6538 100644 --- a/tests/workers/conftest.py +++ b/tests/workers/conftest.py @@ -10,6 +10,7 @@ import platform import queue import stat +import sys import typing import cruizlib.workers.api as workers_api @@ -308,22 +309,39 @@ def _the_fixture( watcher_thread: TestableThread, context: typing.Optional[multiprocessing.context.SpawnContext], ) -> None: + def _have_conan_symbols_leaked() -> None: + assert "conans" not in sys.modules + if context is None: # abusing the type system, as the API used for queue.Queue is the same # as for multiprocessing.Queue worker(reply_queue, params) else: + _have_conan_symbols_leaked() process = context.Process(target=worker, args=(reply_queue, params)) process.start() process.join() # tell the watcher thread that there is no more information coming - workers_api.endmessagethread.invoke(reply_queue) # type: ignore[arg-type] + if context is not None: + # this must be done in a separate process because it closes the other side + # of the queue + process = context.Process( + target=workers_api.endmessagethread.invoke, args=(reply_queue,) + ) + process.start() + process.join() + else: + # no need to close ths single process queue + reply_queue.put(End()) watcher_thread.join(timeout=5.0) if watcher_thread.is_alive(): raise texceptions.WatcherThreadTimeoutError() + if context is not None: + _have_conan_symbols_leaked() + return _the_fixture diff --git a/tests/workers/single_process/test_arbitrary_conan_cmd.py b/tests/workers/single_process/test_arbitrary_conan_cmd.py index 579cfb12..e6c6b8aa 100644 --- a/tests/workers/single_process/test_arbitrary_conan_cmd.py +++ b/tests/workers/single_process/test_arbitrary_conan_cmd.py @@ -22,7 +22,7 @@ import texceptions if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture @pytest.mark.parametrize( @@ -63,7 +63,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments def test_arbitrary_conan_command( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], verb: str, @@ -81,7 +81,7 @@ def test_arbitrary_conan_command( if args: params.arguments.extend(args) - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() with expectation: run_worker(worker, reply_queue, params, watcher_thread, context) diff --git a/tests/workers/single_process/test_cmake_build_tool.py b/tests/workers/single_process/test_cmake_build_tool.py index a501592a..93fb37ad 100644 --- a/tests/workers/single_process/test_cmake_build_tool.py +++ b/tests/workers/single_process/test_cmake_build_tool.py @@ -25,7 +25,7 @@ import texceptions if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -37,7 +37,7 @@ strict=True, ) def test_cmake_no_cache( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, tmp_path: pathlib.Path, caplog: pytest.LogCaptureFixture, @@ -49,7 +49,7 @@ def test_cmake_no_cache( params = CommandParameters("cmakebuild", worker) params.cwd = tmp_path # params.added_environment = conan_local_cache - reply_queue, _, watcher_thread, context = reply_queue_fixture() + reply_queue, _, watcher_thread, context = multiprocess_reply_queue_fixture() with pytest.raises( texceptions.FailedMessageTestError, match="Error: could not load cache" ): @@ -73,7 +73,7 @@ def fixture_custom_cmake_command(tmp_path: pathlib.Path) -> pathlib.Path: strict=True, ) def test_cmake_custom_program( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, tmp_path: pathlib.Path, caplog: pytest.LogCaptureFixture, @@ -86,7 +86,7 @@ def test_cmake_custom_program( params = CommandParameters("cmakebuild", worker) params.cwd = tmp_path params.added_environment = {"CONAN_CMAKE_PROGRAM": os.fspath(custom_cmake_command)} - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies @@ -102,7 +102,7 @@ def test_cmake_custom_program( strict=True, ) def test_cmake_custom_build_tool( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, tmp_path: pathlib.Path, caplog: pytest.LogCaptureFixture, @@ -114,7 +114,7 @@ def test_cmake_custom_build_tool( params = CommandParameters("cmakebuild", worker) params.cwd = tmp_path params.added_environment = {"CONAN_MAKE_PROGRAM": "another_make"} - reply_queue, _, watcher_thread, context = reply_queue_fixture() + reply_queue, _, watcher_thread, context = multiprocess_reply_queue_fixture() with pytest.raises( texceptions.FailedMessageTestError, match="Error: could not load cache" ): @@ -127,7 +127,7 @@ def test_cmake_custom_build_tool( strict=True, ) def test_cmake_use_ninja_generator( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, tmp_path: pathlib.Path, caplog: pytest.LogCaptureFixture, @@ -139,7 +139,7 @@ def test_cmake_use_ninja_generator( params = CommandParameters("cmakebuild", worker) params.cwd = tmp_path params.added_environment = {"CONAN_CMAKE_GENERATOR": "Ninja"} - reply_queue, _, watcher_thread, context = reply_queue_fixture() + reply_queue, _, watcher_thread, context = multiprocess_reply_queue_fixture() with pytest.raises( texceptions.FailedMessageTestError, match="Error: could not load cache" ): @@ -153,7 +153,7 @@ def test_cmake_use_ninja_generator( ) @pytest.mark.parametrize("generator", [None, "Ninja"]) def test_cmake_verbose_output( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, tmp_path: pathlib.Path, caplog: pytest.LogCaptureFixture, @@ -168,7 +168,7 @@ def test_cmake_verbose_output( if generator: params.added_environment = {"CONAN_CMAKE_GENERATOR": generator} params.arguments.append("verbose") - reply_queue, _, watcher_thread, context = reply_queue_fixture() + reply_queue, _, watcher_thread, context = multiprocess_reply_queue_fixture() with pytest.raises( texceptions.FailedMessageTestError, match="Error: could not load cache" ): @@ -181,7 +181,7 @@ def test_cmake_verbose_output( strict=True, ) def test_cmake_set_cpu_count( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, tmp_path: pathlib.Path, caplog: pytest.LogCaptureFixture, @@ -193,7 +193,7 @@ def test_cmake_set_cpu_count( params = CommandParameters("cmakebuild", worker) params.cwd = tmp_path params.added_environment = {"CONAN_CPU_COUNT": "1"} - reply_queue, _, watcher_thread, context = reply_queue_fixture() + reply_queue, _, watcher_thread, context = multiprocess_reply_queue_fixture() with pytest.raises( texceptions.FailedMessageTestError, match="Error: could not load cache" ): diff --git a/tests/workers/single_process/test_conan_autotools_helper.py b/tests/workers/single_process/test_conan_autotools_helper.py index 4cd0e448..a8251414 100644 --- a/tests/workers/single_process/test_conan_autotools_helper.py +++ b/tests/workers/single_process/test_conan_autotools_helper.py @@ -23,7 +23,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -60,7 +60,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments # noqa: E501 def test_conan_autotoolsbuildhelper_configure( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_autotoolsbuildenvironment_configure_recipe: pathlib.Path, conan_local_cache: typing.Dict[str, str], @@ -81,7 +81,9 @@ def test_conan_autotoolsbuildhelper_configure( params.recipe_path = conan_autotoolsbuildenvironment_configure_recipe params.cwd = conan_autotoolsbuildenvironment_configure_recipe.parent params.profile = "default" - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = ( + multiprocess_reply_queue_fixture() + ) run_worker(worker, reply_queue, params, watcher_thread, context) if env_key and env_value: @@ -93,7 +95,7 @@ def test_conan_autotoolsbuildhelper_configure( params.added_environment = conan_local_cache params.recipe_path = conan_autotoolsbuildenvironment_configure_recipe params.cwd = conan_autotoolsbuildenvironment_configure_recipe.parent - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies @@ -114,7 +116,7 @@ def test_conan_autotoolsbuildhelper_configure( ) # pylint: disable=too-many-arguments, too-many-positional-arguments # noqa: E501 def test_conan_autotoolsbuildhelper_make( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_autotoolsbuildenvironment_make_recipe: pathlib.Path, conan_local_cache: typing.Dict[str, str], @@ -139,7 +141,9 @@ def test_conan_autotoolsbuildhelper_make( params.recipe_path = conan_autotoolsbuildenvironment_make_recipe params.cwd = conan_autotoolsbuildenvironment_make_recipe.parent params.profile = "default" - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = ( + multiprocess_reply_queue_fixture() + ) run_worker(worker, reply_queue, params, watcher_thread, context) if env_key and env_value: @@ -151,7 +155,7 @@ def test_conan_autotoolsbuildhelper_make( params.added_environment["CONAN_MAKE_PROGRAM"] = os.fspath(custom_make_command) params.recipe_path = conan_autotoolsbuildenvironment_make_recipe params.cwd = conan_autotoolsbuildenvironment_make_recipe.parent - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_build.py b/tests/workers/single_process/test_conan_build.py index 53abfe9a..17c9cc2d 100644 --- a/tests/workers/single_process/test_conan_build.py +++ b/tests/workers/single_process/test_conan_build.py @@ -21,7 +21,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -67,7 +67,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments # noqa: E501 def test_conan_build( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_recipe: pathlib.Path, conan_local_cache: typing.Dict[str, str], @@ -92,7 +92,9 @@ def test_conan_build( # in the cwd for the install artifacts assert isinstance(value, str) params.install_folder = tmp_path / value - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = ( + multiprocess_reply_queue_fixture() + ) run_worker(worker, reply_queue, params, watcher_thread, context) worker = workers_api.build.invoke @@ -113,7 +115,7 @@ def test_conan_build( elif arg == "package_folder": assert isinstance(value, str) params.package_folder = tmp_path / value - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_cmake_helper.py b/tests/workers/single_process/test_conan_cmake_helper.py index 47020e92..0a25201d 100644 --- a/tests/workers/single_process/test_conan_cmake_helper.py +++ b/tests/workers/single_process/test_conan_cmake_helper.py @@ -22,7 +22,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -44,7 +44,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments # noqa: E501 def test_conan_cmake_helper( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_cmake_helper_recipe: pathlib.Path, conan_local_cache: typing.Dict[str, str], @@ -65,7 +65,9 @@ def test_conan_cmake_helper( params.recipe_path = conan_cmake_helper_recipe params.cwd = conan_cmake_helper_recipe.parent params.profile = "default" - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = ( + multiprocess_reply_queue_fixture() + ) run_worker(worker, reply_queue, params, watcher_thread, context) if env_key and env_value: @@ -76,7 +78,7 @@ def test_conan_cmake_helper( params.added_environment = conan_local_cache params.recipe_path = conan_cmake_helper_recipe params.cwd = conan_cmake_helper_recipe.parent - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_config_install.py b/tests/workers/single_process/test_conan_config_install.py index a73ad951..04a62009 100644 --- a/tests/workers/single_process/test_conan_config_install.py +++ b/tests/workers/single_process/test_conan_config_install.py @@ -26,14 +26,14 @@ import texceptions if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) def test_conan_config_install_missing( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], ) -> None: @@ -42,7 +42,7 @@ def test_conan_config_install_missing( params = CommandParameters("install_config", worker) params.added_environment = conan_local_cache params.named_arguments["pathOrUrl"] = "/some/unknownpath" - reply_queue, _, watcher_thread, context = reply_queue_fixture() + reply_queue, _, watcher_thread, context = multiprocess_reply_queue_fixture() with pytest.raises( texceptions.FailedMessageTestError, match="Unable to deduce type config install", @@ -82,7 +82,7 @@ def fixture_conan_config_git_repo(tmp_path: pathlib.Path) -> pathlib.Path: def test_conan_config_install_from_zip( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], conan_config_zip: pathlib.Path, @@ -94,7 +94,7 @@ def test_conan_config_install_from_zip( params = CommandParameters("install_config", worker) params.added_environment = conan_local_cache params.named_arguments["pathOrUrl"] = os.fspath(conan_config_zip) - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) if CONAN_MAJOR_VERSION == 1: @@ -109,7 +109,7 @@ def test_conan_config_install_from_zip( def test_conan_config_install_from_git( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], conan_config_git_repo: pathlib.Path, @@ -121,7 +121,7 @@ def test_conan_config_install_from_git( params = CommandParameters("install_config", worker) params.added_environment = conan_local_cache params.named_arguments["pathOrUrl"] = os.fspath(conan_config_git_repo) - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) if CONAN_MAJOR_VERSION == 1: @@ -136,7 +136,7 @@ def test_conan_config_install_from_git( def test_conan_config_install_with_git_branch( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], conan_config_git_repo: pathlib.Path, @@ -152,7 +152,7 @@ def test_conan_config_install_with_git_branch( params.added_environment = conan_local_cache params.named_arguments["pathOrUrl"] = os.fspath(conan_config_git_repo) params.named_arguments["gitBranch"] = git_branch_name - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) if CONAN_MAJOR_VERSION == 1: @@ -168,7 +168,7 @@ def test_conan_config_install_with_git_branch( def test_conan_config_install_with_missing_git_branch( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], conan_config_git_repo: pathlib.Path, @@ -188,7 +188,7 @@ def test_conan_config_install_with_missing_git_branch( params.added_environment = conan_local_cache params.named_arguments["pathOrUrl"] = os.fspath(conan_config_git_repo) params.named_arguments["gitBranch"] = git_branch_name - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) if CONAN_MAJOR_VERSION == 1: @@ -204,7 +204,7 @@ def test_conan_config_install_with_missing_git_branch( def test_conan_config_install_from_source_folder( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], conan_config_zip: pathlib.Path, @@ -224,7 +224,7 @@ def test_conan_config_install_from_source_folder( params.added_environment = conan_local_cache params.named_arguments["pathOrUrl"] = os.fspath(conan_config_zip) params.named_arguments["sourceFolder"] = source_folder - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) if CONAN_MAJOR_VERSION == 1: @@ -240,7 +240,7 @@ def test_conan_config_install_from_source_folder( def test_conan_config_install_to_target_folder( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], conan_config_zip: pathlib.Path, @@ -256,7 +256,7 @@ def test_conan_config_install_to_target_folder( params.added_environment = conan_local_cache params.named_arguments["pathOrUrl"] = os.fspath(conan_config_zip) params.named_arguments["targetFolder"] = target_folder - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) if CONAN_MAJOR_VERSION == 1: diff --git a/tests/workers/single_process/test_conan_create.py b/tests/workers/single_process/test_conan_create.py index 0e849a12..22a7bc62 100644 --- a/tests/workers/single_process/test_conan_create.py +++ b/tests/workers/single_process/test_conan_create.py @@ -21,7 +21,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -50,7 +50,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments, too-many-branches, too-many-locals # noqa: E501 def test_conan_create( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_recipe: pathlib.Path, conan_local_cache: typing.Dict[str, str], @@ -87,7 +87,7 @@ def test_conan_create( # since this early Conan version requires a user and channel on pkgrefs params.user = params.user or "test_user" params.channel = params.channel or "test_channel" - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_exportpkg.py b/tests/workers/single_process/test_conan_exportpkg.py index 9121776d..e745de7f 100644 --- a/tests/workers/single_process/test_conan_exportpkg.py +++ b/tests/workers/single_process/test_conan_exportpkg.py @@ -23,7 +23,7 @@ import texceptions if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -43,7 +43,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments, too-many-branches, too-many-locals, too-many-statements # noqa: E501 def test_conan_exportpkg( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_recipe_name: str, conan_recipe: pathlib.Path, @@ -72,7 +72,9 @@ def test_conan_exportpkg( # since this early Conan version requires a user and channel on pkgrefs params.user = params.user or "test_user" params.channel = params.channel or "test_channel" - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = ( + multiprocess_reply_queue_fixture() + ) run_worker(worker, reply_queue, params, watcher_thread, context) worker = workers_api.exportpackage.invoke @@ -119,7 +121,7 @@ def test_conan_exportpkg( assert isinstance(arg, tuple) for index, key in enumerate(arg): setattr(params, key, value[index]) - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies @@ -127,7 +129,9 @@ def test_conan_exportpkg( if CONAN_MAJOR_VERSION == 1: # repeat the export to fail, because it requires a force - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = ( + multiprocess_reply_queue_fixture() + ) with pytest.raises(texceptions.FailedMessageTestError) as exc: run_worker(worker, reply_queue, params, watcher_thread, context) @@ -139,7 +143,7 @@ def test_conan_exportpkg( # Conan 2 does not fail to re-export, not need a force pass - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_imports.py b/tests/workers/single_process/test_conan_imports.py index debf12c8..fe8a11a3 100644 --- a/tests/workers/single_process/test_conan_imports.py +++ b/tests/workers/single_process/test_conan_imports.py @@ -21,7 +21,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -42,7 +42,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments def test_conan_imports( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_recipe: pathlib.Path, conan_local_cache: typing.Dict[str, str], @@ -66,7 +66,7 @@ def test_conan_imports( if arg and isinstance(arg, str) and arg == "install_folder": assert isinstance(value, str) params.install_folder = tmp_path / value - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) worker = workers_api.imports.invoke @@ -81,7 +81,7 @@ def test_conan_imports( elif arg == "imports_folder": assert isinstance(value, str) params.imports_folder = tmp_path / value - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_install.py b/tests/workers/single_process/test_conan_install.py index b82f9209..6a1dcc9d 100644 --- a/tests/workers/single_process/test_conan_install.py +++ b/tests/workers/single_process/test_conan_install.py @@ -21,7 +21,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -51,7 +51,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments, too-many-branches, too-many-locals # noqa: E501 def test_conan_install( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_recipe: pathlib.Path, conan_local_cache: typing.Dict[str, str], @@ -90,7 +90,7 @@ def test_conan_install( assert isinstance(arg, tuple) for index, key in enumerate(arg): setattr(params, key, value[index]) - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_lockcreate.py b/tests/workers/single_process/test_conan_lockcreate.py index e1bb957b..7f9fb47a 100644 --- a/tests/workers/single_process/test_conan_lockcreate.py +++ b/tests/workers/single_process/test_conan_lockcreate.py @@ -24,7 +24,7 @@ import texceptions if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -46,7 +46,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments def test_conan_lock_create( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_recipe_name: str, conan_recipe: pathlib.Path, @@ -66,7 +66,7 @@ def test_conan_lock_create( for key, val in value.items(): params.add_option("test", key, val) - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies @@ -84,7 +84,7 @@ def test_conan_lock_create( strict=True, ) def test_conan_lock_create_dependent_recipes( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_dependent_recipes: typing.Tuple[ pathlib.Path, str, str, pathlib.Path, str, str @@ -106,7 +106,7 @@ def test_conan_lock_create_dependent_recipes( params.user = params.user or "test_user" params.channel = params.channel or "test_channel" - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies @@ -119,7 +119,7 @@ def test_conan_lock_create_dependent_recipes( params.cwd = conan_dependent_recipes[3].parent params.profile = "default" - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_package.py b/tests/workers/single_process/test_conan_package.py index 77d4835e..e4d308eb 100644 --- a/tests/workers/single_process/test_conan_package.py +++ b/tests/workers/single_process/test_conan_package.py @@ -21,7 +21,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -42,7 +42,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments def test_conan_package( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_recipe: pathlib.Path, conan_local_cache: typing.Dict[str, str], @@ -68,7 +68,7 @@ def test_conan_package( # in the cwd for the install artifacts assert isinstance(value, str) params.install_folder = tmp_path / value - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) worker = workers_api.package.invoke @@ -89,7 +89,7 @@ def test_conan_package( elif arg == "package_folder": assert isinstance(value, str) params.package_folder = tmp_path / value - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_remote_package_binary.py b/tests/workers/single_process/test_conan_remote_package_binary.py index 691d859b..2573320a 100644 --- a/tests/workers/single_process/test_conan_remote_package_binary.py +++ b/tests/workers/single_process/test_conan_remote_package_binary.py @@ -21,7 +21,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -49,7 +49,7 @@ ], ) def test_conan_remote_package_binary_download( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], envvars: typing.Dict[str, str], @@ -71,7 +71,7 @@ def test_conan_remote_package_binary_download( ) params.added_environment = conan_local_cache params.added_environment.update(envvars) - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_remote_package_id.py b/tests/workers/single_process/test_conan_remote_package_id.py index c0f5cb5f..6b9dd09e 100644 --- a/tests/workers/single_process/test_conan_remote_package_id.py +++ b/tests/workers/single_process/test_conan_remote_package_id.py @@ -23,7 +23,7 @@ import texceptions if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -53,7 +53,7 @@ ], ) def test_conan_remote_package_id_search( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], envvars: typing.Dict[str, str], @@ -67,7 +67,7 @@ def test_conan_remote_package_id_search( ) params.added_environment = conan_local_cache params.added_environment.update(envvars) - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() with expectation: run_worker(worker, reply_queue, params, watcher_thread, context) diff --git a/tests/workers/single_process/test_conan_remote_package_revisions.py b/tests/workers/single_process/test_conan_remote_package_revisions.py index 756b8618..d5fe18f7 100644 --- a/tests/workers/single_process/test_conan_remote_package_revisions.py +++ b/tests/workers/single_process/test_conan_remote_package_revisions.py @@ -23,7 +23,7 @@ import texceptions if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -53,7 +53,7 @@ ], ) def test_conan_remote_prev_search( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], envvars: typing.Dict[str, str], @@ -76,7 +76,7 @@ def test_conan_remote_prev_search( ) params.added_environment = conan_local_cache params.added_environment.update(envvars) - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() with expectation: run_worker(worker, reply_queue, params, watcher_thread, context) diff --git a/tests/workers/single_process/test_conan_remote_recipe_revisions.py b/tests/workers/single_process/test_conan_remote_recipe_revisions.py index f5804e8d..915c0dde 100644 --- a/tests/workers/single_process/test_conan_remote_recipe_revisions.py +++ b/tests/workers/single_process/test_conan_remote_recipe_revisions.py @@ -23,7 +23,7 @@ import texceptions if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -53,7 +53,7 @@ ], ) def test_conan_remote_rrev_search( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], envvars: typing.Dict[str, str], @@ -67,7 +67,7 @@ def test_conan_remote_rrev_search( ) params.added_environment = conan_local_cache params.added_environment.update(envvars) - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() with expectation: run_worker(worker, reply_queue, params, watcher_thread, context) diff --git a/tests/workers/single_process/test_conan_remote_search.py b/tests/workers/single_process/test_conan_remote_search.py index 17a05f14..b0f47234 100644 --- a/tests/workers/single_process/test_conan_remote_search.py +++ b/tests/workers/single_process/test_conan_remote_search.py @@ -22,7 +22,7 @@ import texceptions if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -41,7 +41,7 @@ ], ) def test_conan_remote_search_pkg_exists( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], aliasaware: bool, @@ -55,7 +55,7 @@ def test_conan_remote_search_pkg_exists( pattern="zlib", ) params.added_environment = conan_local_cache - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() if CONAN_VERSION_COMPONENTS == (1, 17, 1): with pytest.raises(texceptions.FailedMessageTestError) as exc_info: run_worker(worker, reply_queue, params, watcher_thread, context) @@ -73,7 +73,7 @@ def test_conan_remote_search_pkg_exists( def test_conan_remote_search_pkg_not_exists( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], ) -> None: @@ -86,7 +86,7 @@ def test_conan_remote_search_pkg_not_exists( pattern="doesnotexist", ) params.added_environment = conan_local_cache - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() if CONAN_VERSION_COMPONENTS == (1, 17, 1): with pytest.raises(texceptions.FailedMessageTestError) as exc_info: run_worker(worker, reply_queue, params, watcher_thread, context) diff --git a/tests/workers/single_process/test_conan_remove_all_packages.py b/tests/workers/single_process/test_conan_remove_all_packages.py index 5f5de9e3..39298759 100644 --- a/tests/workers/single_process/test_conan_remove_all_packages.py +++ b/tests/workers/single_process/test_conan_remove_all_packages.py @@ -18,14 +18,14 @@ from cruizlib.interop.message import Success if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) def test_conan_remove_all_packages( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], conan_recipe: pathlib.Path, @@ -44,13 +44,13 @@ def test_conan_remove_all_packages( if CONAN_VERSION_COMPONENTS == (1, 17, 1): params.user = "user1" params.channel = "channel1" - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) worker = workers_api.removeallpackages.invoke params = CommandParameters("removeallpackages", worker) params.added_environment = conan_local_cache - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_remove_locks.py b/tests/workers/single_process/test_conan_remove_locks.py index eee874c7..9e7b4360 100644 --- a/tests/workers/single_process/test_conan_remove_locks.py +++ b/tests/workers/single_process/test_conan_remove_locks.py @@ -20,7 +20,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -32,7 +32,7 @@ strict=True, ) def test_conan_remove_locks( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], ) -> None: @@ -40,7 +40,7 @@ def test_conan_remove_locks( worker = workers_api.removelocks.invoke params = CommandParameters("removelocks", worker) params.added_environment = conan_local_cache - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_remove_package.py b/tests/workers/single_process/test_conan_remove_package.py index 270a67d2..29f2d76d 100644 --- a/tests/workers/single_process/test_conan_remove_package.py +++ b/tests/workers/single_process/test_conan_remove_package.py @@ -18,7 +18,7 @@ from cruizlib.interop.message import Success if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -26,7 +26,7 @@ # pylint: disable=too-many-arguments,too-many-positional-arguments def test_conan_remove_package( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], conan_recipe: pathlib.Path, @@ -47,7 +47,7 @@ def test_conan_remove_package( if CONAN_VERSION_COMPONENTS == (1, 17, 1): params.user = "user1" params.channel = "channel1" - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) worker = workers_api.removepackage.invoke @@ -58,7 +58,7 @@ def test_conan_remove_package( params.make_package_reference() # force is required, otherwise stdin is read params.force = True - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_source.py b/tests/workers/single_process/test_conan_source.py index 93f51ba6..779c44c8 100644 --- a/tests/workers/single_process/test_conan_source.py +++ b/tests/workers/single_process/test_conan_source.py @@ -21,7 +21,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -83,7 +83,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments def test_conan_source( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_recipe: pathlib.Path, conan_local_cache: typing.Dict[str, str], @@ -107,7 +107,9 @@ def test_conan_source( if arg and isinstance(arg, str) and arg == "install_folder": assert isinstance(value, str) params.install_folder = tmp_path / value - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = ( + multiprocess_reply_queue_fixture() + ) run_worker(worker, reply_queue, params, watcher_thread, context) worker = workers_api.source.invoke @@ -138,7 +140,7 @@ def test_conan_source( assert isinstance(value, tuple) params.user = value[0] params.channel = value[1] - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_conan_test.py b/tests/workers/single_process/test_conan_test.py index 6aac49e5..e8b33dea 100644 --- a/tests/workers/single_process/test_conan_test.py +++ b/tests/workers/single_process/test_conan_test.py @@ -21,7 +21,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -37,7 +37,7 @@ ) # pylint: disable=too-many-arguments, too-many-positional-arguments, too-many-locals # noqa: E501 def test_conan_test( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_recipe: pathlib.Path, conan_testpackage_recipe: pathlib.Path, @@ -62,7 +62,7 @@ def test_conan_test( if CONAN_VERSION_COMPONENTS == (1, 17, 1): params.user = "user1" params.channel = "channel1" - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) worker = workers_api.testpackage.invoke @@ -86,7 +86,7 @@ def test_conan_test( elif arg == "test_build_folder": assert isinstance(value, str) params.test_build_folder = tmp_path / value - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_delete_cmake_cache.py b/tests/workers/single_process/test_delete_cmake_cache.py index b44fea62..6a3be966 100644 --- a/tests/workers/single_process/test_delete_cmake_cache.py +++ b/tests/workers/single_process/test_delete_cmake_cache.py @@ -21,7 +21,7 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) @@ -34,7 +34,7 @@ strict=True, ) def test_cmake_delete_cache( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, tmp_path: pathlib.Path, caplog: pytest.LogCaptureFixture, @@ -48,7 +48,7 @@ def test_cmake_delete_cache( params.cwd = tmp_path if build_folder: params.build_folder = build_folder - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/single_process/test_expected_failure.py b/tests/workers/single_process/test_expected_failure.py index 385ae08f..e5201ac0 100644 --- a/tests/workers/single_process/test_expected_failure.py +++ b/tests/workers/single_process/test_expected_failure.py @@ -20,14 +20,14 @@ import texceptions if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) def test_expected_failure( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], ) -> None: @@ -35,6 +35,6 @@ def test_expected_failure( worker = workers_api.install.invoke params = CommandParameters("install", worker) params.added_environment = conan_local_cache - reply_queue, _, watcher_thread, context = reply_queue_fixture() + reply_queue, _, watcher_thread, context = multiprocess_reply_queue_fixture() with pytest.raises(texceptions.FailedMessageTestError): run_worker(worker, reply_queue, params, watcher_thread, context) diff --git a/tests/workers/single_process/test_time_commands.py b/tests/workers/single_process/test_time_commands.py index ec295093..9f02cb60 100644 --- a/tests/workers/single_process/test_time_commands.py +++ b/tests/workers/single_process/test_time_commands.py @@ -19,13 +19,13 @@ import pytest if typing.TYPE_CHECKING: - from ttypes import RunWorkerFixture, SingleprocessReplyQueueFixture + from ttypes import MultiprocessReplyQueueFixture, RunWorkerFixture LOGGER = logging.getLogger(__name__) def test_conan_time_command_duration( - reply_queue_fixture: SingleprocessReplyQueueFixture, + multiprocess_reply_queue_fixture: MultiprocessReplyQueueFixture, run_worker: RunWorkerFixture, conan_local_cache: typing.Dict[str, str], caplog: pytest.LogCaptureFixture, @@ -36,7 +36,7 @@ def test_conan_time_command_duration( params = CommandParameters("removeallpackages", worker) params.added_environment = conan_local_cache params.time_commands = True - reply_queue, replies, watcher_thread, context = reply_queue_fixture() + reply_queue, replies, watcher_thread, context = multiprocess_reply_queue_fixture() run_worker(worker, reply_queue, params, watcher_thread, context) assert replies diff --git a/tests/workers/test_env.py b/tests/workers/test_env.py index 4d91c9f8..19479350 100644 --- a/tests/workers/test_env.py +++ b/tests/workers/test_env.py @@ -4,7 +4,7 @@ import typing from cruizlib.environ import EnvironSaver -from cruizlib.workers.utils.env import set_env +from cruizlib.workers.utils.env import clear_conan_env, set_env # pylint: disable=wrong-import-order import pytest @@ -49,3 +49,12 @@ def test_env_add_and_remove( if removed: set_env({}, removed) assert ENVVAR not in os.environ + + +def test_clear_conan_environment_vars(monkeypatch: pytest.MonkeyPatch) -> None: + """Test the removal of Conan environment variables.""" + env_var = "CONAN_BANANA" + monkeypatch.setenv(env_var, "1") + assert env_var in os.environ + clear_conan_env() + assert env_var not in os.environ