diff options
Diffstat (limited to 'coverage/fullcoverage')
-rw-r--r-- | coverage/fullcoverage/encodings.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/coverage/fullcoverage/encodings.py b/coverage/fullcoverage/encodings.py index 9409b7d7..6a258d67 100644 --- a/coverage/fullcoverage/encodings.py +++ b/coverage/fullcoverage/encodings.py @@ -37,14 +37,21 @@ class FullCoverageTracer(object): sys.settrace(FullCoverageTracer().fullcoverage_trace) +# In coverage/files.py is actual_filename(), which uses glob.glob. I don't +# understand why, but that use of glob borks everything if fullcoverage is in +# effect. So here we make an ugly hail-mary pass to switch off glob.glob over +# there. This means when using fullcoverage, Windows path names will not be +# their actual case. + +#sys.fullcoverage = True + # Finally, remove our own directory from sys.path; remove ourselves from # sys.modules; and re-import "encodings", which will be the real package # this time. Note that the delete from sys.modules dictionary has to # happen last, since all of the symbols in this module will become None # at that exact moment, including "sys". -parentdirs = [ d for d in sys.path if __file__.startswith(d) ] -parentdirs.sort(key=len) -sys.path.remove(parentdirs[-1]) +parentdir = max(filter(__file__.startswith, sys.path), key=len) +sys.path.remove(parentdir) del sys.modules['encodings'] import encodings |