-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
testing: allow to instantiate an empty AsyncTestCase #3374
Conversation
`unittest.TestCase` has a feature where it allows instantiating `MyTestClass()` with the default method name `runTest` even if a `runTest` method doesn't actually exist. This is documented in `TestCase`'s docs under "Changed in version 3.2"[0]. Since version 8.2, pytest relies on this, and started breaking on Tornado's `AsyncTestCase`[1]. Change `AsyncTestCase` to allow empty instatiation, by matching the upstream code. [0] https://docs.python.org/3/library/unittest.html#unittest.TestCase [1] pytest-dev/pytest#12263
The motion package installs a motion systemd service, which can block camera devices and hence conflict with the motionEye-controlled motion processes. We hence need to assure that this service is stopped and disabled, before we can start and enable out motioneye.service. Additionally, Tornado python tests are ignored, until a related fix has been merged: tornadoweb/tornado#3374 Signed-off-by: MichaIng <[email protected]>
@bluetech Any estimation when this will be merged and released? |
I want to look at this next week and understand what's going on. Catching an exception and disabling the |
Let me try to clarify: pytest instantiates the test class in two situations:
This PR is meant to support the first case. It is not disabling the
Hmm yes that note is ambiguous but let me try to clarify it. It says: "Changed in version 3.2: |
Yes, I was just researching this and was pulling on the history. I see a better fix for this by moving the check in |
Overriding _callTestMethod (which was introduced in python 3.8) is a less hacky way to detect tests that fail to use ``@gen_test`` where needed. It's not documented, but since Python 3.11 has introduced a similar check to the standard library we'll be able to remove it in the near future. The major impetus for this change is an incompatibility with Pytest 8.2, which has made a change that tries to instantiate test classes at discovery time without an existing method name. Fixes tornadoweb#3375 Closes tornadoweb#3374
Replacement PR is #3382 |
unittest.TestCase
has a feature where it allows instantiatingMyTestClass()
with the default method namerunTest
even if arunTest
method doesn't actually exist. This is documented inTestCase
's docs under "Changed in version 3.2" (link).Since version 8.2, pytest relies on this, and started breaking on Tornado's
AsyncTestCase
, see pytest-dev/pytest#12263.Change
AsyncTestCase
to allow empty instatiation, by matching the upstream code.