diff options
| author | Jonathan Lange <jml@mumak.net> | 2007-01-14 17:33:52 +1100 |
|---|---|---|
| committer | Jonathan Lange <jml@mumak.net> | 2007-01-14 17:33:52 +1100 |
| commit | cb1a0a2e928473ea68649c09b3691886ac93b57a (patch) | |
| tree | 6fd93e243a812de0179d3d63382a21ea373cb51f /python | |
| parent | 501ba57871b35bab0bce1da4b72f7990a4f9dc14 (diff) | |
| download | subunit-git-cb1a0a2e928473ea68649c09b3691886ac93b57a.tar.gz | |
Rename sibpath to join_dir, and add a docstring.
Diffstat (limited to 'python')
| -rw-r--r-- | python/subunit/__init__.py | 18 | ||||
| -rw-r--r-- | python/subunit/tests/test_test_protocol.py | 2 |
2 files changed, 15 insertions, 5 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index f56f724..7a04eb9 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -28,8 +28,18 @@ def test_suite(): return subunit.tests.test_suite() -def sibpath(path, sibling): - return os.path.join(os.path.dirname(os.path.abspath(path)), sibling) +def join_dir(base_path, path): + """ + Returns an absolute path to C{path}, calculated relative to the parent + of C{base_path}. + + @param base_path: A path to a file or directory. + @param path: An absolute path, or a path relative to the containing + directory of C{base_path}. + + @return: An absolute path to C{path}. + """ + return os.path.join(os.path.dirname(os.path.abspath(base_path)), path) class TestProtocolServer(object): @@ -283,8 +293,8 @@ class ExecTestCase(unittest.TestCase): """ unittest.TestCase.__init__(self, methodName) testMethod = getattr(self, methodName) - self.script = sibpath(sys.modules[self.__class__.__module__].__file__, - testMethod.__doc__) + self.script = join_dir(sys.modules[self.__class__.__module__].__file__, + testMethod.__doc__) def countTestCases(self): return 1 diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py index 4cd693d..1ee4886 100644 --- a/python/subunit/tests/test_test_protocol.py +++ b/python/subunit/tests/test_test_protocol.py @@ -570,7 +570,7 @@ class TestExecTestCase(unittest.TestCase): def test_construct(self): test = self.SampleExecTestCase("test_sample_method") self.assertEqual(test.script, - subunit.sibpath(__file__, 'sample-script.py')) + subunit.join_dir(__file__, 'sample-script.py')) def test_run(self): runner = MockTestProtocolServerClient() |
