-
-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverage removes DecoratorTools's tracing function #125
Comments
Fixed in <<changeset ebca9c8e46a6 (bb)>>. I don't know if this solves all the problems with DecoratorTools or not. I'm not a fan of it, I think it's an abuse of settrace, but I hope it works better now. |
Original comment by Anonymous Thanks for looking at this. However, I am still seeing the issue. Using the same attached dec.py, if I change my repro steps to get coverage from hg instead of pypi:
, the same exception still occurs. |
Original comment by Stefano Taschini (Bitbucket: taschini, GitHub: taschini) I incurred in the same problem today. My solution, which seems to be working, was to patch DecoratorTools. I'm using Python 2.7.2, coverage 3.5.1, and DecoratorTools-1.8. Here's the patch:
I hope this helps. |
This replaces accept() with serve() which in turn obsoletes anyio.serve_listeners() which did not make it into any release. Among other things, this lets us do the TLS handshake in the newly spawned handler task. Fixes nedbat#125.
Originally reported by Bobby Impollonia (Bitbucket: bobbyi, GitHub: bobbyi)
The PEAK DecoratorTools library (http://pypi.python.org/pypi/DecoratorTools) uses a tracing function to allow the use of decorators for older versions of Python.
In the past, this library conflicted with coverage because DecoratorTools would add its own tracing function and in the process remove coverage's, causing coverage to believe that no lines were executed. The current (development) version fixes this by restoring any existing tracing functions.
However, when using the current DecoratorTools library with coverage, I run into failures because coverage seems to be removing DecoratorTools's tracing function somehow: when (and only when) using coverage, functions that should be decorated by DecoratorTools act as if they do not have the decorator applied (as if DecoratorTools tracing function were removed).
I have attached a test program called dec.py. With that file in the current directory, you can reproduce the problem as follows (I am using Python 2.6):
The exception is "'MyClass' object has no attribute 'name'" which indicates that our classmethod decorator has been ignored and the method is instead being treated as an instance method.
This issue causes coverage to fail when used with TurboGears applications since TG relies on PEAK Rules which relies on DecoratorTools.
Running with --timid still works, but ideally should no longer be needed now that DecoratorTools has been updated to restore coverage's tracing function.
The text was updated successfully, but these errors were encountered: