summaryrefslogtreecommitdiff
path: root/tests/path.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/path.py')
-rwxr-xr-xtests/path.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/path.py b/tests/path.py
index 959b54875..ef1f35004 100755
--- a/tests/path.py
+++ b/tests/path.py
@@ -142,7 +142,8 @@ class path(text_type):
"""
Returns the text in the file.
"""
- with open(self, mode='U', encoding=encoding, **kwargs) as f:
+ mode = 'rU' if PY2 else 'r'
+ with open(self, mode=mode, encoding=encoding, **kwargs) as f:
text = f.read()
contents = repr_as(text, '<%s contents>' % self.basename())
return contents