summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.hgignore2
-rw-r--r--coverage/codeunit.py4
-rw-r--r--coverage/files.py8
3 files changed, 8 insertions, 6 deletions
diff --git a/.hgignore b/.hgignore
index 3716b4f..eec265c 100644
--- a/.hgignore
+++ b/.hgignore
@@ -11,7 +11,7 @@ syntax: glob
# Stuff in the root.
build
-coverage.egg-info
+*.egg-info
dist
htmlcov
MANIFEST
diff --git a/coverage/codeunit.py b/coverage/codeunit.py
index 3b0407a..d85735d 100644
--- a/coverage/codeunit.py
+++ b/coverage/codeunit.py
@@ -2,7 +2,7 @@
import glob, os
-from coverage.backward import string_class, BytesIO
+from coverage.backward import string_class, StringIO
from coverage.misc import CoverageException
@@ -135,6 +135,6 @@ class CodeUnit:
raise CoverageException(
"No source for code %r." % self.filename
)
- return BytesIO(source)
+ return StringIO(source)
return open(self.filename)
diff --git a/coverage/files.py b/coverage/files.py
index cce33c9..9bc8ac5 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -49,9 +49,9 @@ class FileLocator:
def get_zip_data(self, filename):
"""Get data from `filename` if it is a zip file path.
- Returns the data read from the zip file, or None if no zip file could
- be found or `filename` isn't in it. The data returned might be "" if
- the file is empty.
+ Returns the string data read from the zip file, or None if no zip file
+ could be found or `filename` isn't in it. The data returned will be
+ an empty string if the file is empty.
"""
import zipimport
@@ -67,5 +67,7 @@ class FileLocator:
data = zi.get_data(parts[1])
except IOError:
continue
+ if sys.hexversion > 0x03000000:
+ data = data.decode('utf8') # TODO: How to do this properly?
return data
return None