Closed GoogleCodeExporter closed 9 years ago
Your patch doesn't really solve the race condition, since your callback could
run between initializing Error, and setting up the local copy of 'calls'.
In this case, it seems like your test should block until you know your code has
completed (or should have completed) before verifying.
Making mox thread-safe is a larger issue.
Sorry for the huge delay on this bug. I'm trying to work through the backlog
today.
Original comment by steve.mi...@gmail.com
on 17 Jun 2010 at 8:07
You're wrong here. Twisted is single thread - it uses a reactor. The callback
can't run while the object is being created. I've never spoke about
multithreading - it's a totally different matter.
Original comment by alan.fra...@gmail.com
on 18 Jun 2010 at 10:39
I'm not familiar with twisted or reactor, but I'm pretty sure that you code is
using threads. Maybe I'm confused, but I'd be *very* interested to see a call
stack where your callback runs between exception creation and raising without a
context switch.
Original comment by stev...@google.com
on 18 Jun 2010 at 4:26
http://en.wikipedia.org/wiki/Reactor_pattern
I think you missed the point, or I wasn't very clear.
The exception is raised indeed at the proper point. But twisted own's TestCase,
being designed for working in async, does not raise the exception *immediately*
; it uses a concept called "Failure"
http://twistedmatrix.com/documents/8.1.0/api/twisted.python.failure.Failure.html
Which offers a way to propagate an exception through a chain of callbacks.
http://diigo.com/0bg0q
The exception is not shown as soon as it's raised - which would make the
exception show up indeed! Instead, it gets wrapped in a failure and shown a bit
later - in this time, the call gets done and the call gets cleared.
Original comment by alan.fra...@gmail.com
on 18 Jun 2010 at 5:42
Original issue reported on code.google.com by
alan.fra...@gmail.com
on 9 Oct 2009 at 4:22Attachments: