Number of statement detection wrong if no newline at end of file · Issue #293 · nedbat/coveragepy (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
Originally reported by Marc Schlaich (Bitbucket: schlamar, GitHub: schlamar)
Coverage does not detect number of statements correctly in a multi line statement if it is not followed by a newline until Python 3.3. It works in Python 3.4.
#!text
$ cat cov_error.py
import subprocess
import sys
out, err = subprocess.Popen(
[sys.executable, '-c', 'pass'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE).communicate()
$ py -2.7 -m coverage run cov_error.py && py -2.7 -m coverage report
Name Stmts Miss Cover
-------------------------------
cov_error 6 0 100%
$ echo "" >> cov_error.py
$ py -2.7 -m coverage run cov_error.py && py -2.7 -m coverage report
Name Stmts Miss Cover
-------------------------------
cov_error 3 0 100%
$ # revert new line in editor
$ py -3.3 -m coverage run cov_error.py && py -3.3 -m coverage report
Name Stmts Miss Cover
-------------------------------
cov_error 6 0 100%
$ py -3.4 -m coverage run cov_error.py && py -3.4 -m coverage report
Name Stmts Miss Cover
-------------------------------
cov_error 3 0 100%