summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDasIch <dasdasich@gmail.com>2010-06-19 19:58:28 +0200
committerDasIch <dasdasich@gmail.com>2010-06-19 19:58:28 +0200
commit6680b807c17db68681a98a89f92a3dec944d2eda (patch)
tree54c525dbb6501db8f5a1d10d1f906b73ec5f1027 /tests
parent64b37e03e42f94ddd9486d0afd1ffd5e47cc1f4e (diff)
downloadsphinx-6680b807c17db68681a98a89f92a3dec944d2eda.tar.gz
Fixed the coverage extension test as well as the coverage extension itself for python3
Diffstat (limited to 'tests')
-rw-r--r--tests/path.py27
-rw-r--r--tests/test_coverage.py2
2 files changed, 28 insertions, 1 deletions
diff --git a/tests/path.py b/tests/path.py
index 28a8c22a..df96bce4 100644
--- a/tests/path.py
+++ b/tests/path.py
@@ -142,6 +142,33 @@ class path(str):
finally:
f.close()
+ def bytes(self):
+ """
+ Returns the bytes in the file.
+ """
+ f = open(self, mode='rb')
+ try:
+ return f.read()
+ finally:
+ f.close()
+
+ def write_bytes(self, bytes, append=False):
+ """
+ Writes the given `bytes` to the file.
+
+ :param append:
+ If ``True`` given `bytes` are added at the end of the file.
+ """
+ if append:
+ mode = 'ab'
+ else:
+ mode = 'wb'
+ f = open(self, mode=mode)
+ try:
+ f.write(bytes)
+ finally:
+ f.close()
+
def exists(self):
"""
Returns ``True`` if the path exist.
diff --git a/tests/test_coverage.py b/tests/test_coverage.py
index 1262ebf5..cb831635 100644
--- a/tests/test_coverage.py
+++ b/tests/test_coverage.py
@@ -33,7 +33,7 @@ def test_build(app):
assert 'api.h' in c_undoc
assert ' * Py_SphinxTest' in c_undoc
- undoc_py, undoc_c = pickle.loads((app.outdir / 'undoc.pickle').text())
+ undoc_py, undoc_c = pickle.loads((app.outdir / 'undoc.pickle').bytes())
assert len(undoc_c) == 1
# the key is the full path to the header file, which isn't testable
assert undoc_c.values()[0] == [('function', 'Py_SphinxTest')]