Skip to content

Commit

Permalink
Fix runTest issue on tornado + pytest
Browse files Browse the repository at this point in the history
This is a workaround which resolves marshmallow-code#941 for now.
  • Loading branch information
sirosen committed May 17, 2024
1 parent dc24388 commit f3a8b6e
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tests/test_tornadoparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -460,7 +476,7 @@ def get(self, id, args):
)


class TestApp(AsyncHTTPTestCase):
class TestApp(BaseAsyncTestCase):
def get_app(self):
return echo_app

Expand Down Expand Up @@ -528,7 +544,7 @@ def post(self, args):
)


class TestValidateApp(AsyncHTTPTestCase):
class TestValidateApp(BaseAsyncTestCase):
def get_app(self):
return validate_app

Expand Down

0 comments on commit f3a8b6e

Please sign in to comment.