Beispiel #1
0
def test_pull_analyzer() -> None:
    with patch.object(docker.client.ImageCollection, "pull", return_value=None) as spy:
        with patch(
            "bento.extra.r2c_analyzer._should_pull_analyzer", return_value=False
        ):
            # Should not pull
            prepull_analyzers("r2c/checked-return", Version("0.1.11"))
            assert spy.call_count == 0

        with patch("bento.extra.r2c_analyzer._should_pull_analyzer", return_value=True):
            # Should pull three times
            prepull_analyzers("r2c/checked-return", Version("0.1.11"))
            assert spy.call_count == 3

        with patch(
            "bento.extra.r2c_analyzer._should_pull_analyzer",
            side_effect=[False, True, False],
        ):
            # Should pull one more time
            prepull_analyzers("r2c/checked-return", Version("0.1.11"))
            assert spy.call_count == 4
Beispiel #2
0
    def setup(self) -> None:
        # import inside def for performance
        from bento.extra.r2c_analyzer import prepull_analyzers

        prepull_analyzers(self.ANALYZER_NAME, self.ANALYZER_VERSION)
Beispiel #3
0
 def setup(self) -> None:
     prepull_analyzers(self.ANALYZER_NAME, self.ANALYZER_VERSION)