diff options
author | Gael Pasgrimaud <gael@gawel.org> | 2020-08-02 23:26:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-02 23:26:19 +0200 |
commit | 3d09494d80713a32d9bc52e457bff16fb6ba285c (patch) | |
tree | a1f1f644bf365d3e840263c49cd2ca31cf158a63 | |
parent | 4c27a07730763d3d63d132a75d822a4f29179adc (diff) | |
parent | 03395151089dd58170f9542c99dbee6f20eeb090 (diff) | |
download | webtest-3d09494d80713a32d9bc52e457bff16fb6ba285c.tar.gz |
Merge pull request #227 from adamchainz/pytest_collect_warning
Prevent PytestCollectionWarning for TestApp
-rw-r--r-- | tests/test_app.py | 3 | ||||
-rw-r--r-- | webtest/app.py | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_app.py b/tests/test_app.py index 0c611fb..c823baa 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -19,6 +19,9 @@ class TestApp(unittest.TestCase): def setUp(self): self.app = webtest.TestApp(debug_app) + def test_pytest_collection_disabled(self): + self.assertFalse(webtest.TestApp.__test__) + def test_encode_multipart_relative_to(self): app = webtest.TestApp(debug_app, relative_to=os.path.dirname(__file__)) diff --git a/webtest/app.py b/webtest/app.py index fe7011f..ccf5c5c 100644 --- a/webtest/app.py +++ b/webtest/app.py @@ -141,6 +141,9 @@ class TestApp(object): RequestClass = TestRequest + # Tell pytest not to collect this class as tests + __test__ = False + def __init__(self, app, extra_environ=None, relative_to=None, use_unicode=True, cookiejar=None, parser_features=None, json_encoder=None, lint=True): |