Skip to content

Commit

Permalink
Run tests with sack in tmp directory
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mracek authored and jrohel committed Nov 25, 2020
1 parent af452ac commit 5c8d027
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/api/test_dnf_module_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,26 @@
import dnf
import dnf.module.module_base

import os
import shutil
import tempfile

from .common import TestCase


class DnfModuleBaseApiTest(TestCase):
def setUp(self):
self.base = dnf.Base(dnf.conf.Conf())
self._installroot = tempfile.mkdtemp(prefix="dnf_test_installroot_")
self.base.conf.installroot = self._installroot
self.base.conf.cachedir = os.path.join(self._installroot, "var/cache/dnf")
self.base._sack = dnf.sack._build_sack(self.base)
self.moduleBase = dnf.module.module_base.ModuleBase(self.base)

def tearDown(self):
self.base.close()
if self._installroot.startswith("/tmp/"):
shutil.rmtree(self._installroot)

def test_init(self):
moduleBase = dnf.module.module_base.ModuleBase(self.base)
Expand Down Expand Up @@ -51,12 +61,7 @@ def test_reset(self):
def test_install(self):
# ModuleBase.install()
self.assertHasAttr(self.moduleBase, "install")
self.assertRaises(
AttributeError,
self.moduleBase.install,
module_specs=[],
strict=False,
)
self.moduleBase.install(module_specs=[], strict=False)

def test_remove(self):
# ModuleBase.remove()
Expand Down

0 comments on commit 5c8d027

Please sign in to comment.