예제 #1
0
    def test_import_not_installed(self, fake_kedro_cli, python_call_mock,
                                  module_name, mocker, fake_repo_path):
        mocker.patch.dict("sys.modules", {module_name: None})

        result = CliRunner().invoke(fake_kedro_cli.cli, ["lint"])
        expected_message = NO_DEPENDENCY_MESSAGE.format(
            module=module_name, src=str(fake_repo_path / "src"))

        assert result.exit_code, result.stdout
        assert expected_message in result.stdout
        python_call_mock.assert_not_called()
예제 #2
0
    def test_pytest_not_installed(self, fake_kedro_cli, python_call_mock,
                                  mocker, fake_repo_path):
        mocker.patch.dict("sys.modules", {"pytest": None})

        result = CliRunner().invoke(fake_kedro_cli.cli,
                                    ["test", "--random-arg", "value"])
        expected_message = NO_DEPENDENCY_MESSAGE.format(
            module="pytest", src=str(fake_repo_path / "src"))

        assert result.exit_code
        assert expected_message in result.stdout
        python_call_mock.assert_not_called()
예제 #3
0
    def test_import_not_installed(
        self,
        fake_project_cli,
        python_call_mock,
        module_name,
        side_effects,
        mocker,
        fake_repo_path,
        fake_metadata,
    ):
        # pretending we have the other linting dependencies, but not the <module_name>
        mocker.patch("kedro.framework.cli.utils.import_module",
                     side_effect=side_effects)

        result = CliRunner().invoke(fake_project_cli, ["lint"],
                                    obj=fake_metadata)
        expected_message = NO_DEPENDENCY_MESSAGE.format(
            module=module_name, src=str(fake_repo_path / "src"))

        assert result.exit_code, result.stdout
        assert expected_message in result.stdout
        python_call_mock.assert_not_called()