Exemple #1
0
    def test_not_solved_without_error(self, context: Context) -> None:
        """Test a not found package is not accepted by sieve."""
        package_version, project = self._get_case()
        (GraphDatabase.should_receive("has_python_solver_error").with_args(
            package_version.name,
            package_version.locked_version,
            package_version.index.url,
            os_name=None,
            os_version=None,
            python_version=None,
        ).and_return(True).once())

        context.graph = GraphDatabase()
        context.project = flexmock(
            runtime_environment=RuntimeEnvironment.from_dict({}))

        assert not context.stack_info, "No stack info should be provided before test run"

        sieve = SolvedSieve()
        sieve.pre_run()

        with SolvedSieve.assigned_context(context):
            assert list(sieve.run(p for p in [package_version])) == []

        assert context.stack_info, "No stack info provided by the pipeline unit"
        assert self.verify_justification_schema(context.stack_info) is True
Exemple #2
0
    def test_not_solved_without_error(self, context: Context) -> None:
        """Test a not found package is not accepted by sieve."""
        package_version, project = self._get_case()
        (GraphDatabase.should_receive("has_python_solver_error").with_args(
            package_version.name,
            package_version.locked_version,
            package_version.index.url,
            os_name=None,
            os_version=None,
            python_version=None,
        ).and_return(True).once())

        context.graph = GraphDatabase()
        context.project = flexmock(
            runtime_environment=RuntimeEnvironment.from_dict({}))

        assert not context.stack_info, "No stack info should be provided before test run"

        sieve = SolvedSieve()
        sieve.pre_run()

        with SolvedSieve.assigned_context(context):
            assert list(sieve.run(p for p in [package_version])) == []
            sieve.post_run()

        assert context.stack_info, "No stack info provided by the pipeline unit"
        assert context.stack_info == [{
            "link":
            jl("install_error"),
            "message":
            "The following versions of 'tensorflow' from "
            "'https://pypi.org/simple' were removed due to installation "
            "issues in the target environment: 2.0.0",
            "type":
            "WARNING",
        }]

        assert self.verify_justification_schema(context.stack_info) is True