diff --git a/tests/test_main.py b/tests/test_main.py index 12937a0..19e9891 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -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 @@ -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", @@ -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