Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-fs committed Oct 7, 2023
1 parent 094d6e6 commit a4cc8fb
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
from click.testing import CliRunner

from pybuild_deps import __main__
from pybuild_deps import __main__ as main


@pytest.fixture
Expand All @@ -16,23 +16,10 @@ def runner() -> CliRunner:

def test_main_succeeds(runner: CliRunner) -> None:
"""It exits with a status code of zero."""
result = runner.invoke(__main__.cli)
result = runner.invoke(main.cli)
assert result.exit_code == 0


def test_log_level(runner: CliRunner, mocker):
"""Test setting log level."""
patched_logconfig = mocker.patch(
"pybuild_deps.__main__.logging.basicConfig", side_effect=RuntimeError("STOP!!!")
)
result = runner.invoke(
__main__.cli, ["--log-level", "INFO", "find-build-deps", "a", "b"]
)
assert result.exit_code == 1
assert isinstance(result.exception, RuntimeError)
assert patched_logconfig.call_args == mocker.call(level="INFO")


@pytest.mark.e2e
@pytest.mark.parametrize(
"package_name,version,expected_deps",
Expand All @@ -55,11 +42,11 @@ def test_find_build_deps(
):
"""End to end testing for find-build-deps command."""
assert not cache.exists()
result = runner.invoke(__main__.find_build_deps, args=[package_name, version])
result = runner.invoke(main.cli, args=["find-build-deps", package_name, version])
assert result.exit_code == 0
assert result.stdout.splitlines() == expected_deps
assert cache.exists()
# repeating the same test to cover a cached version
result = runner.invoke(__main__.find_build_deps, args=[package_name, version])
result = runner.invoke(main.cli, args=["find-build-deps", package_name, version])
assert result.exit_code == 0
assert result.stdout.splitlines() == expected_deps

0 comments on commit a4cc8fb

Please sign in to comment.