summaryrefslogtreecommitdiff
path: root/python/subunit/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/subunit/__init__.py')
-rw-r--r--python/subunit/__init__.py18
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