MacroPy tracing not working for me...
Skip Montanaro
skip at pobox.com
Tue Aug 19 10:18:51 EDT 2014
I just downloaded and installed MacroPy (pip install --user MacroPy),
with an intention of sticking a "with trace:" inside a failing unit
test being run with nosetests. If I understood the example on the PyPI
page correctly, I should have been able to do this:
import macropy.tracing
with macropy.tracing.trace:
... my broken code here ...
(The first example is just "with trace: ..." and doesn't say where the
trace object came from. I assumed it came from the tracing module.)
Instead, I got a traceback:
Traceback (most recent call last):
File "/opt/TWWfsw/nose11/lib/python27/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/skipm/src/git/python/snake/tests/test_contracts/test_sessiontimes.py",
line 36, in test_grain_break_session
with macropy.tracing.trace:
AttributeError: __exit__
Inspecting the trace object in at the REPL, I see nothing which looks
like __exit__:
>>> import macropy.tracing
>>> dir(macropy.tracing.trace)
['__call__', '__class__', '__delattr__', '__dict__', '__doc__',
'__format__', '__getattribute__', '__getitem__', '__hash__',
'__init__', '__module__', '__name__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__',
'__subclasshook__', '__weakref__', 'func', 'msg']
>>> type(macropy.tracing.trace)
<class 'macropy.core.macros.WrappedFunction'>
Is there a different "trace" object somewhere in the macropy package I
should be using?
Thx,
Skip
More information about the Python-list
mailing list