coverage.py fail on Synax Error: invalid syntax

charles.merriam avatarcharles.merriam created an issue

Coverage.py fails when the last line on the source file does not end in a LF. This is a known exec() wart. Lines with just spaces in the last line do trigger this failure. Usually, people just a "LF" to be sure.

(live_dectools)~/p/decorator_toolkit/dectools (master)$ coverage run test/test_all.py
Traceback (most recent call last):
  File "/home/chasm/.virtualenvs/live_dectools/bin/coverage", line 8, in <module>
    load_entry_point('coverage==3.2', 'console_scripts', 'coverage')()
  File "/home/chasm/.virtualenvs/live_dectools/lib/python2.6/site-packages/coverage-3.2-py2.6-linux-i686.egg/coverage/cmdline.py", line 590, in main
    status = CoverageScript().command_line(sys.argv[1:])
  File "/home/chasm/.virtualenvs/live_dectools/lib/python2.6/site-packages/coverage-3.2-py2.6-linux-i686.egg/coverage/cmdline.py", line 468, in command_line
    self.run_python_file(args[0], args)
  File "/home/chasm/.virtualenvs/live_dectools/lib/python2.6/site-packages/coverage-3.2-py2.6-linux-i686.egg/coverage/execfile.py", line 43, in run_python_file
    exec_function(source, filename, main_mod.__dict__)
  File "<exec_function>", line 2, in exec_function
  File "test/test_all.py", line 59
    
SyntaxError: invalid syntax

Branch cb8970df breaks coverage.py Branch ccd69d1 does not break coverage.py git:github.com/merriam/dectools

Hope you enjoyed Pycon. Loved your talk. email if you have questions; charles.merriam@gmail.com

Comments (1)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.