Skip to content

coverage.py fail on Synax Error: invalid syntax #47

@nedbat

Description

@nedbat

Originally reported by charles.merriam (Bitbucket: charles.merriam, GitHub: Unknown)


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.

#!bash

(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 (bb) breaks coverage.py
Branch ccd69d1 (bb) 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


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions