aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMykyta Holubakha <hilobakho@gmail.com>2017-06-30 04:49:25 +0300
committerMykyta Holubakha <hilobakho@gmail.com>2017-06-30 04:49:25 +0300
commitc94c01482fb6cdbe017d33ed0668bcb80ba06017 (patch)
treeb3d4169f121c865af037c6753d94e1978a1c6e85 /tests
parentFix unit tests (diff)
downloadpomu-c94c01482fb6cdbe017d33ed0668bcb80ba06017.tar.gz
pomu-c94c01482fb6cdbe017d33ed0668bcb80ba06017.tar.bz2
pomu-c94c01482fb6cdbe017d33ed0668bcb80ba06017.zip
Multiple changes and fixes for installation
make package backend optional fix merge destination makedir properly add files to git index compare package slot with default the right way multiple fixes in writing metadata changed tests to reflect current code and pass
Diffstat (limited to 'tests')
-rw-r--r--tests/test_dispatch.py47
-rw-r--r--tests/test_init.py6
2 files changed, 30 insertions, 23 deletions
diff --git a/tests/test_dispatch.py b/tests/test_dispatch.py
index ebb450f..58d08fb 100644
--- a/tests/test_dispatch.py
+++ b/tests/test_dispatch.py
@@ -1,7 +1,7 @@
import shutil
import unittest
-from os import path
+from os import path, makedirs
from tempfile import mkdtemp
from pomu.package import Package
@@ -20,13 +20,15 @@ class DummySource():
@classmethod
def fetch_package(cls, uri):
- return Package(cls, 'test', cls.path)
+ return Package('test', cls.path, backend=cls, category='test')
+
class DispatcherTests(unittest.TestCase):
def setUp(self):
pomu_active_repo._drop()
self.source_path = mkdtemp()
- with open(path.join(self.source_path, 'test.ebuild'), 'w+') as f:
+ makedirs(path.join(self.source_path, 'test'))
+ with open(path.join(self.source_path, 'test', 'test.ebuild'), 'w+') as f:
f.write('# Copytight 1999-2017\nAll Rights Reserved\nEAPI="0"\n')
DummySource.path = self.source_path
@@ -37,17 +39,18 @@ class DispatcherTests(unittest.TestCase):
def testFetch(self):
pkg = dispatcher.get_package('/test').unwrap()
- self.assertEqual(pkg.files, [('', 'test.ebuild')])
+ self.assertEqual(pkg.files, [('test', 'test.ebuild')])
def tearDown(self):
shutil.rmtree(self.source_path)
-"""
+
class InstallTests(unittest.TestCase):
def setUp(self):
pomu_active_repo._drop()
self.source_path = mkdtemp()
- with open(path.join(self.source_path, 'test.ebuild'), 'w+') as f:
+ makedirs(path.join(self.source_path, 'test'))
+ with open(path.join(self.source_path, 'test', 'test.ebuild'), 'w+') as f:
f.write('# Copytight 1999-2017\nAll Rights Reserved\nEAPI="0"\n')
DummySource.path = self.source_path
@@ -60,24 +63,24 @@ class InstallTests(unittest.TestCase):
shutil.rmtree(self.repo_dir)
def testPkgCreate(self):
- pkg = Package('test', self.source_path, files=['test.ebuild'])
- self.assertEqual(pkg.files, [('', 'test.ebuild')])
-
- def testPkgMerge(self):
- pkg = Package('test', self.source_path)
- self.repo.merge(pkg).expect()
+ pkg = Package('test', self.source_path, category='test', files=['test/test.ebuild'])
+ self.assertEqual(pkg.files, [('test', 'test.ebuild')])
def testPortagePkg(self):
pkg = dispatcher.get_package('sys-apps/portage').expect()
self.repo.merge(pkg).expect()
- def testPkgUnmerge(self):
- pkg = Package('test', self.source_path)
- self.repo.merge(pkg).expect()
- with self.subTest(i=0):
- self.repo.unmerge(pkg).expect()
- with self.subTest(i=1):
- self.repo.remove_package('test').expect()
- with self.subTest(i=2):
- self.repo.remove_package('tset').expect_err()
-"""
+# TODO: convert to LocalEbuildFile backend
+# def testPkgMerge(self):
+# pkg = Package('test', self.source_path, category='test')
+# self.repo.merge(pkg).expect()
+#
+# def testPkgUnmerge(self):
+# pkg = Package('test', self.source_path, category='test')
+# self.repo.merge(pkg).expect()
+# with self.subTest(i=0):
+# self.repo.unmerge(pkg).expect()
+# with self.subTest(i=1):
+# self.repo.remove_package('test').expect()
+# with self.subTest(i=2):
+# self.repo.remove_package('tset').expect_err()
diff --git a/tests/test_init.py b/tests/test_init.py
index 0c68324..bece6f9 100644
--- a/tests/test_init.py
+++ b/tests/test_init.py
@@ -30,7 +30,6 @@ class PlainRepoInitialization(unittest.TestCase):
class PortageRepoInitialization(unittest.TestCase):
def setUp(self):
- pomu_active_repo._drop()
os.environ['EROOT'] = REPO_PATH
os.environ['ROOT'] = REPO_PATH
os.environ['PORTAGE_CONFIGROOT'] = REPO_PATH
@@ -42,6 +41,11 @@ class PortageRepoInitialization(unittest.TestCase):
self.REPO_DIR = REPO_DIR
def tearDown(self):
+ pomu_active_repo._drop()
+ del os.environ['EROOT']
+ del os.environ['ROOT']
+ del os.environ['PORTAGE_CONFIGROOT']
+ importlib.reload(portage)
rmtree(REPO_PATH)
def testRepoList(self):