Skip to content

Commit

Permalink
Replace .pyc with .py when doing diff comparisons.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkaemming committed Dec 19, 2012
1 parent 680fff0 commit c388e39
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions quickunit/plugin.py
Expand Up @@ -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
Expand All @@ -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):]
Expand Down

0 comments on commit c388e39

Please sign in to comment.