From 713b98ad6b46105693364a944b285faa5b4c78e3 Mon Sep 17 00:00:00 2001 From: Paul Gevers Date: Mon, 13 Aug 2018 21:05:04 +0200 Subject: [PATCH] inst_tester: add is_pkg_in_testing --- britney2/installability/tester.py | 8 ++++++++ tests/test_inst_tester.py | 2 ++ 2 files changed, 10 insertions(+) diff --git a/britney2/installability/tester.py b/britney2/installability/tester.py index d945311..d173b75 100644 --- a/britney2/installability/tester.py +++ b/britney2/installability/tester.py @@ -162,6 +162,14 @@ class InstallabilityTester(object): """ return not self._testing.isdisjoint(pkgs) + def is_pkg_in_testing(self, pkg): + """Test if the package of is in testing + + :param pkgs: A package id (as defined in the constructor) + :return: True if the pkg is currently in testing + """ + return pkg in self._testing + def add_testing_binary(self, pkg_id): """Add a binary package to "testing" diff --git a/tests/test_inst_tester.py b/tests/test_inst_tester.py index 62b7ed4..a2e820b 100644 --- a/tests/test_inst_tester.py +++ b/tests/test_inst_tester.py @@ -31,6 +31,8 @@ class TestInstTester(unittest.TestCase): universe.remove_testing_binary(pkg_perl) assert not universe.any_of_these_are_in_testing((pkg_perl,)) assert universe.any_of_these_are_in_testing((pkg_lintian,)) + assert not universe.is_pkg_in_testing(pkg_perl) + assert universe.is_pkg_in_testing(pkg_lintian) assert not universe.is_installable(pkg_lintian) assert not universe.is_installable(pkg_perl) universe.add_testing_binary(pkg_perl)