Skip to content
Browse files

Merge pull request #1 from tkaemming/clean-bytecode-extension

Replace `.pyc` with `.py` when doing diff comparisons.
  • Loading branch information...
2 parents 680fff0 + c388e39 commit 0adc8ff98cff8b22045f88385d002d1a0fb51db0 @dcramer committed Dec 19, 2012
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):]

0 comments on commit 0adc8ff

Please sign in to comment.
Something went wrong with that request. Please try again.