diff options
Diffstat (limited to 'tests/test_dispatch.py')
-rw-r--r-- | tests/test_dispatch.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/test_dispatch.py b/tests/test_dispatch.py index 5ccba6d..ebb450f 100644 --- a/tests/test_dispatch.py +++ b/tests/test_dispatch.py @@ -6,32 +6,32 @@ from tempfile import mkdtemp from pomu.package import Package from pomu.repo.init import init_plain_repo -from pomu.repo.repo import Repository +from pomu.repo.repo import Repository, pomu_active_repo from pomu.source import dispatcher from pomu.util.result import Result @dispatcher.source class DummySource(): @dispatcher.handler(priority=3) - @classmethod - def parse(cls, uri): + def parse(uri): if uri.startswith('/'): return Result.Ok(uri[1:]) return Result.Err() @classmethod def fetch_package(cls, uri): - return Package('test', cls.path) + return Package(cls, 'test', cls.path) class DispatcherTests(unittest.TestCase): def setUp(self): + pomu_active_repo._drop() self.source_path = mkdtemp() - with path.join(self.source_path, 'test.ebuild') as f: + with open(path.join(self.source_path, 'test.ebuild'), 'w+') as f: f.write('# Copytight 1999-2017\nAll Rights Reserved\nEAPI="0"\n') DummySource.path = self.source_path def testDispatch(self): - self.assertEqual(dispatcher.get_package_source('/test').unwrap(), 'test') + self.assertEqual(dispatcher.get_package_source('/test').unwrap(), DummySource) self.assertTrue(dispatcher.get_package_source('test').is_err()) self.assertTrue(dispatcher.get_package('sys-apps/portage').is_ok()) @@ -42,10 +42,12 @@ class DispatcherTests(unittest.TestCase): def tearDown(self): shutil.rmtree(self.source_path) +""" class InstallTests(unittest.TestCase): def setUp(self): + pomu_active_repo._drop() self.source_path = mkdtemp() - with path.join(self.source_path, 'test.ebuild') as f: + with open(path.join(self.source_path, 'test.ebuild'), 'w+') as f: f.write('# Copytight 1999-2017\nAll Rights Reserved\nEAPI="0"\n') DummySource.path = self.source_path @@ -78,3 +80,4 @@ class InstallTests(unittest.TestCase): self.repo.remove_package('test').expect() with self.subTest(i=2): self.repo.remove_package('tset').expect_err() +""" |