Re: [Twisted-Python] pytest-twisted questions

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)
Victor, what was your intention with the project?
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#L... https://github.com/pytest-dev/pytest-twisted/blob/master/pytest_twisted.py#L... https://github.com/pytest-dev/pytest-twisted/blob/master/pytest_twisted.py#L... https://github.com/pytest-dev/pytest-twisted/blob/master/pytest_twisted.py#L... 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?
https://docs.pytest.org/en/latest/faq.html#how-does-pytest-relate-to-twisted... 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?
My experience with Twisted over the last 10 years or so is that this is an exceedingly dangerous approach to take... cheers, Chris

On 2018-11-13 17:37, Chris Withers wrote:
I don't believe so. It sounds like I should review twisted.trial.unittest.TestCase and consider implementing a fixture to provide the checks. Perhaps default it to autouse with a cli parameter to disable it. Perhaps #4 is relevant though. https://github.com/pytest-dev/pytest-twisted/issues/4 https://github.com/altendky/stlib/blob/b34796cbba959d9cb2cb843f3cc5fc815c7cb... Cheers, -kyle

On 2018-11-13 17:37, Chris Withers wrote:
I don't believe so. It sounds like I should review twisted.trial.unittest.TestCase and consider implementing a fixture to provide the checks. Perhaps default it to autouse with a cli parameter to disable it. Perhaps #4 is relevant though. https://github.com/pytest-dev/pytest-twisted/issues/4 https://github.com/altendky/stlib/blob/b34796cbba959d9cb2cb843f3cc5fc815c7cb... Cheers, -kyle
participants (2)
-
Chris Withers
-
Kyle Altendorf