Ned Batchelder  committed b8635d6

Messages with filenames are not good as %r, because it doubles the backslashes...

  • Participants
  • Parent commits d8add0d

Comments (0)

Files changed (4)

File coverage/

         # Couldn't find source.
         raise CoverageException(
-            "No source for code %r." % self.filename
+            "No source for code '%s'." % self.filename
     def should_be_python(self):

File coverage/

             except IOError:
                 _, err, _ = sys.exc_info()
                 raise NoSource(
-                    "No source for code: %r: %s" % (self.filename, err)
+                    "No source for code: '%s': %s" % (self.filename, err)
         # Scrap the BOM if it exists.

File coverage/

             if not os.path.exists(self.filename):
                 source = self.coverage.file_locator.get_zip_data(self.filename)
                 if not source:
-                    raise NoSource("No source for code: %r" % self.filename)
+                    raise NoSource("No source for code: '%s'" % self.filename)
         self.parser = CodeParser(
             text=source, filename=self.filename,

File test/

 # -*- coding: utf-8 -*-
 """Tests that HTML generation is awesome."""
-import os.path, sys
+import os.path, re, sys
 import coverage
 from coverage.misc import NotPython, NoSource
         missing_file = os.path.join(self.temp_dir, "sub", "")
-            "No source for code: '%s'" % missing_file,
+            "(?i)No source for code: '%s'" % re.escape(missing_file),