Portage has some tests that use the unittest framework that ships with python (2.3-2.4ish)
Tests have a specific naming convention.
-in tests/ there is a runTest script that invokes tests/__init__.py
+in pym/portage/tests/ there is a runTest script that invokes pym/portage/tests/__init__.py
This init looks at a hardcoded list of test dirs to search for tests.
If you add a new dir and don't see your new tests, make sure that the dir is in this list.
So if I was to write a vercmp test, and vercmp is in portage_versions.
-tests/portage_versions/test_vercmp.py
+pym/portage/tests/portage_versions/test_vercmp.py
would be the filename.
The __init__.py file now does recursive tests, but you need to tell it so. For example, if
you had cache tests the dir format would be something like...
-tests/cache/flat_hash/test_foo.py
+pym/portage/tests/cache/flat_hash/test_foo.py
and you would put "cache/flat_hash" into the testDirs variable in __init__.py.
+
+emerge
+------
+
+The emerge namespace currently has 0 tests (and no runner)
raise
return result
-test_cpvs = ['sys-apps/portage','virtual/portage']
+test_cps = ['sys-apps/portage','virtual/portage']
test_versions = ['1.0', '1.0-r1','2.3_p4','1.0_alpha57']
test_slots = [ None, '1','gentoo-sources-2.6.17','spankywashere']
test_usedeps = ['foo','-bar', ['foo','bar'],['foo','-bar'] ]
from portage.dep import dep_getusedeps
import sys
-from portage.tests import test_cpvs, test_slots, test_versions, test_usedeps
+from portage.tests import test_cps, test_slots, test_versions, test_usedeps
class DepGetUseDeps(TestCase):
""" A simple testcase for dep_getusedeps
def testDepGetUseDeps(self):
-
- for mycpv in test_cpvs:
+ for mycpv in test_cps:
for version in test_versions:
for slot in test_slots:
for use in test_usedeps:
-# test_match_from_list.py -- Portage Unit Testing Functionality
-# Copyright 2006 Gentoo Foundation
+# test_get_operator.py -- Portage Unit Testing Functionality
+# Copyright 2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$