Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ytausch committed Nov 25, 2024
1 parent 1f863eb commit fcd48e6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
23 changes: 19 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,34 @@ def test_cli_mock_commands_pass_context(


@pytest.mark.parametrize("job, n_jobs", [(1, 5), (3, 7), (4, 4)])
@pytest.mark.parametrize("package", ["foo", "bar", "baz"])
@pytest.mark.parametrize("feedstock", ["foo", "bar"])
@mock.patch("conda_forge_tick.update_upstream_versions.main")
def test_cli_mock_update_upstream_versions(
cmd_mock: MagicMock, job: int, n_jobs: int, package: str
cmd_mock: MagicMock, job: int, n_jobs: int, feedstock: str
):
runner = CliRunner()
result = runner.invoke(
main,
["update-upstream-versions", f"--job={job}", f"--n-jobs={n_jobs}", package],
["update-upstream-versions", f"--job={job}", f"--n-jobs={n_jobs}", feedstock],
)

assert result.exit_code == 0
cmd_mock.assert_called_once_with(mock.ANY, job=job, n_jobs=n_jobs, package=package)
cmd_mock.assert_called_once_with(
mock.ANY, job=job, n_jobs=n_jobs, feedstock=feedstock
)


@pytest.mark.parametrize("feedstock", ["foo", "bar"])
@mock.patch("conda_forge_tick.auto_tick.main")
def test_cli_mock_auto_tick(cmd_mock: MagicMock, feedstock: str):
runner = CliRunner()
result = runner.invoke(
main,
["auto-tick", feedstock],
)

assert result.exit_code == 0
cmd_mock.assert_called_once_with(mock.ANY, feedstock=feedstock)


@pytest.mark.parametrize("job, n_jobs", [(1, 5), (3, 7), (4, 4)])
Expand Down
6 changes: 3 additions & 3 deletions tests/test_upstream_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,15 +1223,15 @@ def test_include_node_bad_pull_request_upstream(caplog):


def test_update_upstream_versions_nonexistent_package(caplog):
feedstock_name = "nonexistent-package"
feedstock_name = "nonexistent-feedstock"

caplog.set_level(logging.DEBUG)
update_upstream_versions(
nx.DiGraph(),
feedstock=feedstock_name,
)

assert "Package nonexistent-package not found in graph" in caplog.text
assert "Feedstock nonexistent-feedstock not found in graph" in caplog.text


@mock.patch("conda_forge_tick.update_upstream_versions.filter_nodes_for_job")
Expand Down Expand Up @@ -1645,7 +1645,7 @@ def test_main(
makedirs_mock.assert_called_once_with("versions", exist_ok=True)
load_graph_mock.assert_called_once()
update_upstream_versions_mock.assert_called_once_with(
gx, debug=debug, job=3, n_jobs=10, package="testpackage"
gx, debug=debug, job=3, n_jobs=10, feedstock="testpackage"
)


Expand Down

0 comments on commit fcd48e6

Please sign in to comment.