From f3a8b6eb4fcd3a748ff5391e7a82382050522721 Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Fri, 17 May 2024 11:50:04 -0500 Subject: [PATCH] Fix runTest issue on tornado + pytest This is a workaround which resolves #941 for now. --- tests/test_tornadoparser.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/test_tornadoparser.py b/tests/test_tornadoparser.py index 4e2b2e14..ea206ab8 100644 --- a/tests/test_tornadoparser.py +++ b/tests/test_tornadoparser.py @@ -8,8 +8,8 @@ import tornado.httpserver import tornado.httputil import tornado.ioloop +import tornado.testing import tornado.web -from tornado.testing import AsyncHTTPTestCase from webargs import fields, missing from webargs.core import json, parse_json @@ -20,6 +20,22 @@ use_kwargs, ) + +class BaseAsyncTestCase(tornado.testing.AsyncHTTPTestCase): + # this isn't a real test case itself + __test__ = False + + # Workaround for https://github.com/pytest-dev/pytest/issues/12263. + # + # this was suggested by one of the pytest maintainers while a patch + # for Tornado is pending + # + # we may need it even after the patch, since we want to support testing on + # older Tornado versions until we drop support for them + def runTest(self): + pass + + name = "name" value = "value" @@ -460,7 +476,7 @@ def get(self, id, args): ) -class TestApp(AsyncHTTPTestCase): +class TestApp(BaseAsyncTestCase): def get_app(self): return echo_app @@ -528,7 +544,7 @@ def post(self, args): ) -class TestValidateApp(AsyncHTTPTestCase): +class TestValidateApp(BaseAsyncTestCase): def get_app(self): return validate_app