summaryrefslogtreecommitdiff
path: root/python/subunit
diff options
context:
space:
mode:
Diffstat (limited to 'python/subunit')
-rw-r--r--python/subunit/__init__.py5
-rw-r--r--python/subunit/tests/test_test_protocol.py6
2 files changed, 11 insertions, 0 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index d97a15b..caab176 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -27,6 +27,11 @@ def test_suite():
import subunit.tests
return subunit.tests.test_suite()
+
+def sibpath(path, sibling):
+ return os.path.join(os.path.dirname(os.path.abspath(path)), sibling)
+
+
class TestProtocolServer(object):
"""A class for receiving results from a TestProtocol client."""
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
index 2530f25..e6d6f0d 100644
--- a/python/subunit/tests/test_test_protocol.py
+++ b/python/subunit/tests/test_test_protocol.py
@@ -19,6 +19,7 @@
import unittest
from StringIO import StringIO
+import os
import subunit
import sys
@@ -593,6 +594,11 @@ class TestExecTestCase(unittest.TestCase):
def test_count_test_cases(self):
"""TODO run the child process and count responses to determine the count."""
+ def test_sibpath(self):
+ sibling = subunit.sibpath(__file__, 'foo')
+ expected = '%s/foo' % (os.path.split(__file__)[0],)
+ self.assertEqual(sibling, expected)
+
class DoExecTestCase(subunit.ExecTestCase):