summaryrefslogtreecommitdiff
path: root/_pytest
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-10-05 15:16:08 -0400
committerBenjamin Peterson <benjamin@python.org>2013-10-05 15:16:08 -0400
commit56e6ae567c85106cdc24d00c8e901126a689f287 (patch)
treee02d195c3cdab8952e3db329c0ba0e60c87cb2f0 /_pytest
parent33b663e03d7673fc92d7dee27c845d0431890b44 (diff)
downloadpytest-56e6ae567c85106cdc24d00c8e901126a689f287.tar.gz
fix detection of the coding cookie when it is on the second line of the file (fixes #330)
Diffstat (limited to '_pytest')
-rw-r--r--_pytest/assertion/rewrite.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py
index 8ef27ac15..f79698ae4 100644
--- a/_pytest/assertion/rewrite.py
+++ b/_pytest/assertion/rewrite.py
@@ -221,7 +221,7 @@ def _rewrite_test(state, fn):
end2 = source.find("\n", end1 + 1)
if (not source.startswith(BOM_UTF8) and
cookie_re.match(source[0:end1]) is None and
- cookie_re.match(source[end1:end2]) is None):
+ cookie_re.match(source[end1 + 1:end2]) is None):
if hasattr(state, "_indecode"):
return None # encodings imported us again, we don't rewrite
state._indecode = True