From 10a609bfd77ece83a55357b3a099fbeb71e41960 Mon Sep 17 00:00:00 2001 From: Joachim Filip Ignacy Bartosik Date: Sat, 17 Apr 2010 14:22:59 +0200 Subject: [PATCH 2/2] Removed tests since there are no tests for repoman now. --- .../tests/checks/P_shouldnt_be_in_source_ri.py | 61 -------------------- 1 files changed, 0 insertions(+), 61 deletions(-) delete mode 100644 pym/repoman/tests/checks/P_shouldnt_be_in_source_ri.py diff --git a/pym/repoman/tests/checks/P_shouldnt_be_in_source_ri.py b/pym/repoman/tests/checks/P_shouldnt_be_in_source_ri.py deleted file mode 100644 index 3308e55..0000000 --- a/pym/repoman/tests/checks/P_shouldnt_be_in_source_ri.py +++ /dev/null @@ -1,61 +0,0 @@ -import unittest -from portage.tests import TestCase -from repoman.checks import PNotInSourceUri -''' - using real _emerge.Package.Package turned out to be very troublesome. - I had - #begin source... don't mind abusing spaces it's just a comment - import portage - from portage import portdb - from _emerge.Package import Package - from _emerge.RootConfig import RootConfig - - cpv = "app-editors/vim-7.2.402" - allvars = set(x for x in portage.auxdbkeys if not x.startswith("UNUSED_")) - metadata = portdb.aux_get( cpv, allvars) - root_config = RootConfig(portage.config(), "/usr/portage", None) - pkg = Package( cpv = cpv, metadata = metadata, root_config = root_config) - #end source - - but it still didn't work so I gave up and wrote FakePackage. - Making test a lot more complicated than tested code is wong IMO. -''' -class FakePackage: - metadata = dict() - cpv_split = (u'c', u'p', u'v', 'r') - -class TestPNotInSourceUri(unittest.TestCase): - uri_name_ok= ( - (u'http://foomatic/foobar.tar.gz', (u'foo-matic', u'foobar', u'1', u'r0')), - (u'http://foomatic.org/1/foobar.tar.gz', (u'foo-matic', u'foobar', u'1', u'r0'))) - - uri_name_bad= ( - (u'http://foomatic.org/foobar/1.tgz', (u'foo-matic', u'foobar', u'1', u'r0')), - (u'http://foomatic.org/foobar-1.tar.gz', (u'foo-matic', u'foobar', u'1', u'r0')), - (u'http://foomatic/FOOBAR-1.htm', (u'foo-matic', u'foobar', u'1', u'r0')), - (u'http://foomatic/foobar-1/get_me.tar.gz', (u'foo-matic', u'foobar', u'1', u'r0'))) - - testee = PNotInSourceUri() - pkg = FakePackage( ) - - def check_returns_none(self, uri, cpv): - self.pkg.metadata['SRC_URI'] = uri - self.pkg.cpv_split = cpv - self.testee.new( self.pkg) - return self.testee.check( 1, "") is None - - def test_accept_any_EAPI(self): - for eapi in ('0', '1', '2', '3', '3_pre2', '4'): - self.assertTrue(self.testee.check_eapi(eapi)) - - def test_accept_no_p_in_src_uri(self): - for uri_name in self.uri_name_ok: - self.assertTrue(self.check_returns_none(uri_name[0], uri_name[1])) - - def test_reject_p_in_src_uri(self): - for uri_name in self.uri_name_bad: - self.assertFalse(self.check_returns_none(uri_name[0], uri_name[1])) - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TestPNotInSourceUri) - unittest.TextTestRunner(verbosity=2).run(suite) -- 1.7.0.4