Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replace `.pyc` with `.py` when doing diff comparisons.

  • Loading branch information...
commit c388e39f1fd81614683fc021f04788eae90e6b43 1 parent 680fff0
@tkaemming tkaemming authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 quickunit/plugin.py
View
12 quickunit/plugin.py
@@ -21,6 +21,16 @@
from quickunit.utils import is_py_script
+def clean_bytecode_extension(filename):
+ """
+ Replaces Python bytecode extensions (``.pyc``) with their source extension.
+ """
+ path, extension = os.path.splitext(filename)
+ if extension == '.pyc':
+ filename = '%s.py' % path
+ return filename
+
+
class FileAcceptedCache(dict):
def __init__(self, prefixes, pending_files, diff_data, root=None):
self.prefixes = prefixes
@@ -34,6 +44,8 @@ def __missing__(self, filename):
return self[filename]
def check(self, filename):
+ filename = clean_bytecode_extension(filename)
+
# check if this test was modified (e.g. added/changed)
if self.root and filename.startswith(self.root):
filename = filename[len(self.root):]
Please sign in to comment.
Something went wrong with that request. Please try again.