Skip to content

Commit

Permalink
Merge pull request #330 from mvo5/less-cruft-2
Browse files Browse the repository at this point in the history
test: remove `test/aptroot` usage
  • Loading branch information
mvo5 authored Aug 5, 2022
2 parents 244baa2 + a1493c0 commit 5f979a2
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 15 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/build/
/test/.coverage
/test/.mypy_cache/
/test/aptroot/var/cache/
/test/packages/test-package*.deb
/test/u-u.lock
__pycache__/
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 1 addition & 4 deletions test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ def setUp(self):
# reset apt config
apt.apt_pkg.init_config()
apt.apt_pkg.config.set("APT::Architecture", "amd64")
# FIXME: would be nice to only set this if needed
apt.apt_pkg.config.set(
"Dir", os.path.join(os.path.dirname(__file__), "aptroot"))
apt.apt_pkg.init_system()
# must be last
self._saved_apt_conf = {}
for k in apt.apt_pkg.config.keys():
Expand Down Expand Up @@ -93,6 +89,7 @@ def make_fake_aptroot(self, template=None, fake_pkgs=[]):
apt.apt_pkg.config.set("Dir::State::status", mock_dpkg_status)
apt.apt_pkg.config.clear("DPkg::Pre-Invoke")
apt.apt_pkg.config.clear("DPkg::Post-Invoke")
apt.apt_pkg.config.clear("DPkg::Pre-Install-Pkgs")
apt.apt_pkg.config.set("Debug::NoLocking", "true")
# we don't really run dpkg
fake_dpkg = os.path.join(aptroot, "usr", "bin", "dpkg")
Expand Down
12 changes: 2 additions & 10 deletions test/test_minimal_partitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,8 @@ class TestMinimalPartitions(TestBase):

def setUp(self):
TestBase.setUp(self)
# setup dry-run mode for apt
apt_pkg.config.set("Debug::NoLocking", "1")
# apt_pkg.config.set("Debug::pkgDPkgPM", "1")
apt_pkg.config.set(
"Dir::State::extended_states",
os.path.join(self.tempdir, "extended_states"))
self.addCleanup(apt_pkg.config.clear, "Dir::state::extended_states")
apt_pkg.config.clear("Dpkg::Post-Invoke")
apt_pkg.config.clear("Dpkg::Pre-Install-Pkgs")
rootdir = os.path.join(self.testdir, "aptroot")
rootdir = self.make_fake_aptroot(
template=os.path.join(os.path.dirname(__file__), "root.minimal-partitions"))
self.cache = apt.Cache(rootdir=rootdir)
# mock LogDir config
self.u_u_logdir = apt_pkg.config.get("Unattended-Upgrade::LogDir")
Expand Down

0 comments on commit 5f979a2

Please sign in to comment.