Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
(#819) Fix unit test bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rtuck99 committed Jan 31, 2024
1 parent 14da16a commit f02716a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test_pin_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@


@pytest.fixture
def pinned_versions():
def patched_run_pip_freeze():
with patch("pin_versions.run_pip_freeze") as run_pip_freeze:
with open("test_data/pip_freeze.txt") as freeze_output:
mock_process = MagicMock()
run_pip_freeze.return_value = mock_process
mock_process.stdout = freeze_output.read()
mock_process.returncode = 0
yield run_pip_freeze


@pytest.mark.parametrize(
Expand Down Expand Up @@ -56,15 +57,15 @@ def test_unpin():


@patch("pin_versions.stdout")
def test_write_commit_message(mock_stdout, pinned_versions):
def test_write_commit_message(mock_stdout, patched_run_pip_freeze):
installed_versions = pin_versions.fetch_pin_versions()
pin_versions.write_commit_message(installed_versions)
mock_stdout.write.assert_called_once_with(
"Pin dependencies prior to release. Dodal 1.13.1, nexgen 0.8.0"
)


def test_pin(pinned_versions):
def test_pin(patched_run_pip_freeze):
installed_versions = pin_versions.fetch_pin_versions()
with io.StringIO() as output_file:
with open("test_data/setup.cfg.unpinned") as input_file:
Expand Down

0 comments on commit f02716a

Please sign in to comment.