Update dnfbase (formerly yumbase) for DNF support

And adjust tests to match.
This commit is contained in:
Brian C. Lane 2018-05-02 09:58:29 -07:00
parent 7fa009c66e
commit e1be281fbb
2 changed files with 29 additions and 2 deletions

View File

@ -47,6 +47,8 @@ def get_base_object(conf):
dbc.installroot = dnfroot
if not os.path.isdir(dnfroot):
os.makedirs(dnfroot)
if not os.path.isdir(repodir):
os.makedirs(repodir)
dbc.cachedir = cachedir
dbc.reposdir = [repodir]

View File

@ -25,7 +25,7 @@ from pylorax.api.config import configure, make_dnf_dirs
from pylorax.api.dnfbase import get_base_object
class YumbaseTest(unittest.TestCase):
class DnfbaseNoSystemReposTest(unittest.TestCase):
@classmethod
def setUpClass(self):
self.tmp_dir = tempfile.mkdtemp(prefix="lorax.test.dnfbase.")
@ -69,7 +69,32 @@ use_system_repos = False
self.assertEqual({}, self.dbo.repos)
class CreateYumDirsTest(unittest.TestCase):
class DnfbaseSystemReposTest(unittest.TestCase):
@classmethod
def setUpClass(self):
self.tmp_dir = tempfile.mkdtemp(prefix="lorax.test.dnfbase.")
# will read the above configuration
config = configure(root_dir=self.tmp_dir)
make_dnf_dirs(config)
# will read composer config and store a dnf config file
self.dbo = get_base_object(config)
# will read the stored dnf config file
self.dnfconf = configparser.ConfigParser()
self.dnfconf.read([config.get("composer", "dnf_conf")])
@classmethod
def tearDownClass(self):
shutil.rmtree(self.tmp_dir)
def test_uses_system_repos(self):
# no other repos defined for this test
self.assertTrue(len(self.dbo.repos) > 0)
class CreateDnfDirsTest(unittest.TestCase):
@classmethod
def setUpClass(self):
self.tmp_dir = tempfile.mkdtemp(prefix="lorax.test.dnfbase.")