diff options
author | Danny Allen <me@dannya.com> | 2014-08-11 16:13:06 +0100 |
---|---|---|
committer | Danny Allen <me@dannya.com> | 2014-08-11 16:13:06 +0100 |
commit | e38016c499921dd7bf5919a699a76305a1936129 (patch) | |
tree | 07a4125732561f2489dfb6b75a339cfef46d80d4 /coverage/html.py | |
parent | c81183f614ca982cd2ed93ac8e6e76610d162202 (diff) | |
parent | ee5ea987f8978d91c1ef189fe4f334511ddf6215 (diff) | |
download | python-coveragepy-git-e38016c499921dd7bf5919a699a76305a1936129.tar.gz |
Merged ned/coveragepy into default
Diffstat (limited to 'coverage/html.py')
-rw-r--r-- | coverage/html.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/coverage/html.py b/coverage/html.py index 42da2972..6e21efaa 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -149,9 +149,7 @@ class HtmlReporter(Reporter): def html_file(self, cu, analysis): """Generate an HTML file for one source file.""" - source_file = cu.source_file() - with source_file: - source = source_file.read() + source = cu.source() # Find out if the file on disk is already correct. flat_rootname = cu.flat_rootname() @@ -241,7 +239,9 @@ class HtmlReporter(Reporter): })) if sys.version_info < (3, 0): - html = html.decode(encoding) + # In theory, all the characters in the source can be decoded, but + # strange things happen, so use 'replace' to keep errors at bay. + html = html.decode(encoding, 'replace') html_filename = flat_rootname + ".html" html_path = os.path.join(self.directory, html_filename) |