trace.py tries to get coverage information from non Python files, which raises a SyntaxError because the file doesn't contain valid Python code. I've attached a path that fixes this problem in Python 2.5.
Hi, Amaury. I found this problem using the Bitten continuous integration system (http://bitten.edgewall.org/ticket/304). I'm using the TurboGears framework with Genshi, and therefore mypackage.templates module should contain non-Python files. Here you'll find its contents: https://tracker.gnulinuxmatters.org/browser/animador/trunk/animador/template This is the only situation where the problem occurs, AFAIK. If you want to reproduce it, you can: 1.- Install Bitten: easy_install http://svn.edgewall.org/repos/bitten/trunk/ 2.- Install my package: svn co https://svn.gnulinuxmatters.org:81/animador/trunk/ animador cd animador ./setup.py develop 3.- Run Bitten's "unittest" extension for setuptools under my package with the following options: ./setup.py unittest --xml-output build/test-results.xml --coverage-summary build/test-coverage.txt --coverage-dir build/coverage Then you'll get a SyntaxError if the patch I attached is not applied. Cheers.
The patch adds this check: + if not filename.endswith((".pyc", ".pyo", ".py")): + continue This is not valid. A Python file is a text file with python code. In spite of import conventions, they are not required to have any particular extension and some people omit them from main scripts. Trace works fine with such files now and your patch would prevent that. Python files are only identified as such by trying to parse them. The problem and solution lie with your setup. Arrange things so Bitten only treats Python files as Python files.
History
Date
User
Action
Args
2022-04-11 14:56:36
admin
set
github: 47685
2011-06-26 20:41:13
terry.reedy
set
status: open -> closedtitle: trace.py tries to get coverage data from non Python files -> 3rd party program calls trace.py on non Python filesnosy: + terry.reedyversions: + Python 2.7, Python 3.2, - Python 2.6, Python 3.1messages: + resolution: not a bugstage: test needed -> patch review