diff --git a/tests/conftest.py b/tests/conftest.py index aaac3649c..83b3654a3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -79,3 +79,12 @@ def mock_release_file(): m = mock_open(read_data=read_data) with patch("builtins.open", m): yield m + + +@pytest.fixture() +def captured_shell_commands(monkeypatch): + commands = [] + with monkeypatch.context() as m: + m.setattr("komodo.build.shell", lambda cmd: commands.append(cmd)) + m.setattr("komodo.fetch.shell", lambda cmd: commands.append(cmd)) + yield commands diff --git a/tests/test_build.py b/tests/test_build.py index 8e0af39d8..522b44f54 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -6,14 +6,6 @@ from komodo.package_version import LATEST_PACKAGE_ALIAS -@pytest.fixture() -def captured_shell_commands(monkeypatch): - commands = [] - with monkeypatch.context() as m: - m.setattr("komodo.build.shell", lambda cmd: commands.append(cmd)) - yield commands - - def test_make_with_empty_pkgs(captured_shell_commands, tmpdir): make({}, {}, {}, str(tmpdir)) assert len(captured_shell_commands) == 1 diff --git a/tests/test_fetch.py b/tests/test_fetch.py index d473a891e..76ffb8a45 100644 --- a/tests/test_fetch.py +++ b/tests/test_fetch.py @@ -7,14 +7,6 @@ from komodo.package_version import LATEST_PACKAGE_ALIAS -@pytest.fixture() -def captured_shell_commands(monkeypatch): - commands = [] - with monkeypatch.context() as m: - m.setattr("komodo.fetch.shell", lambda cmd: commands.append(cmd)) - yield commands - - def test_make_one_pip_package(captured_shell_commands, tmpdir): packages = {"pyaml": "20.4.0"} repositories = {