diff options
| author | Jonathan Lange <jml@mumak.net> | 2007-01-14 17:35:05 +1100 |
|---|---|---|
| committer | Jonathan Lange <jml@mumak.net> | 2007-01-14 17:35:05 +1100 |
| commit | f7c5ccbc7732ff89c07da3bb822d7ab95542ca7c (patch) | |
| tree | 6fd93e243a812de0179d3d63382a21ea373cb51f /python/subunit/__init__.py | |
| parent | 46661c83dee2138c9918798f36d8b40edab5ffad (diff) | |
| parent | cb1a0a2e928473ea68649c09b3691886ac93b57a (diff) | |
| download | subunit-git-f7c5ccbc7732ff89c07da3bb822d7ab95542ca7c.tar.gz | |
Make ExecTestCase test docstrings/paths relative to the test module they
are defined in.
Diffstat (limited to 'python/subunit/__init__.py')
| -rw-r--r-- | python/subunit/__init__.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index d97a15b..7a04eb9 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -27,6 +27,21 @@ def test_suite(): import subunit.tests return subunit.tests.test_suite() + +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): """A class for receiving results from a TestProtocol client.""" @@ -278,7 +293,8 @@ class ExecTestCase(unittest.TestCase): """ unittest.TestCase.__init__(self, methodName) testMethod = getattr(self, methodName) - self.script = testMethod.__doc__ + self.script = join_dir(sys.modules[self.__class__.__module__].__file__, + testMethod.__doc__) def countTestCases(self): return 1 |
