diff --git a/test/test_repolib.py b/test/test_repolib.py index f338632a44..e4c125b514 100644 --- a/test/test_repolib.py +++ b/test/test_repolib.py @@ -29,9 +29,10 @@ # repofile must be patched and reloaded to import AptRepofile, otherwise # the class is not defined in the first place -deb_mock = MagicMock() +deb_mock, apt_mock = MagicMock() deb_mock.Deb822 = dict -with patch.dict("rhsm.repofile.sys.modules", {"debian.deb822": deb_mock}): +apt_mock.Cache = dict +with patch.dict("rhsm.repofile.sys.modules", {"debian.deb822": deb_mock, "apt": apt_mock}): reload(repofile) from rhsm.repofile import AptRepoFile reload(repofile) @@ -908,7 +909,7 @@ def test_releasever_the_string_none(self): class AptRepoFileTest(unittest.TestCase): def _helper_stub_repo(self, *args, **kwargs): - with patch("rhsm.repofile.apt", True): + with patch("rhsm.repofile.apt", dict): repo = Repo(*args, **kwargs) return repo