Skip to content

Commit

Permalink
WIP: fix repolib tests for apt. mock apt
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernhard committed Aug 1, 2024
1 parent 1b10d0b commit 36239ee
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/test_repolib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 36239ee

Please sign in to comment.