On 13/11/2018 20:31, Kyle Altendorf wrote:
I would just open an issue on GitHub. Feel free to copy this in as the
first message to keep the initial context.
Well, there's no specific issue to log here, so let's keep on going with
email for now :-)
(in fact, copying in the twisted mailing list, as that's probably the
right place for this)
On 2018-11-13 12:35, Chris Withers wrote:
- What's the intention of the plugin? Should all tests still subclass
twisted.trial.unittest.TestCase or should they *never* do so if using
this plugin?
I don't know what _should_ be done,
Victor, what was your intention with the project?
but I know that I mostly don't have
test classes and, for the class I do have, I didn't inherit. Mostly I
just @pytest.inlineCallbacks (I still don't like the namespace squashing
into pytest though :] ) and I suppose in the probably-not-too-distant
future I'll instead be using more @pytest_twisted.async_await (ala
#31/#34).
Okay, but twisted.trial.unittest.TestCase does a bunch of reactor
management stuff, most notable making you aware when you've left the
reactor in a bad state. As far as I can see from the code,
pytest-twisted does not do that, correct?
- What's with the greenlet mentions? Is this plugin okay to use when
I'm just using a normal Twisted epoll reactor?
https://github.com/pytest-dev/pytest-twisted/blob/master/pytest_twisted.py#L4
https://github.com/pytest-dev/pytest-twisted/blob/master/pytest_twisted.py#L36-L46
https://github.com/pytest-dev/pytest-twisted/blob/master/pytest_twisted.py#L68-L83
https://github.com/pytest-dev/pytest-twisted/blob/master/pytest_twisted.py#L123-L126
What does greenlet have to do with twisted in this context? Would be
great to have it as an optional thing, unless I'm missing something?
- What does pytest provide *without* this plugin, when it comes to
testing with Twisted?
I am not aware of anything twisted/pytest specific that is outside
pytest-twisted,
https://docs.pytest.org/en/latest/faq.html#how-does-pytest-relate-to-twisted-s-trial
So, my guess is that twisted.trial.unittest.TestCase subclasses
unittest.TestCase and so pytest treats it in the same way. That means
you get the management and checking of the reactor, along with the handy
methods it provides, when you put your tests in class-based suites that
subclass twisted.trial.unittest.TestCase.
Ronny, does pytest do anything else that's twisted-specific?
If you are just trying to get started with something that works, I'd
skip the classes and inheritance and just let the reactor take care of
itself.
My experience with Twisted over the last 10 years or so is that this is
an exceedingly dangerous approach to take...
cheers,
Chris
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python