summaryrefslogtreecommitdiff
path: root/paste/fixture.py
diff options
context:
space:
mode:
authorDaniel Hahler <github@thequod.de>2018-10-30 13:40:53 +0100
committerChris Dent <chris.dent@gmail.com>2018-10-30 12:40:53 +0000
commit455203d2b3b0c898df6d3661cb1de577dfeda483 (patch)
treec86f8fd4df56ac146bcfdc87552dc645516c9d80 /paste/fixture.py
parent495ff974d1a972f3751bd6d142813f326bc3f1c1 (diff)
downloadpaste-git-455203d2b3b0c898df6d3661cb1de577dfeda483.tar.gz
Pytest fixes (#9)
* pytest: fix collection warnings via __test__=False Fixes > "cannot collect test class %r because it has a __init__ constructor Ref: https://github.com/pytest-dev/pytest/issues/2007 * pytest: configure testpaths This is faster with test collection. * pytest: fix warning with doctests Fixes > /usr/lib/python3.7/site-packages/_pytest/python.py:764: > RemovedInPytest4Warning: usage of Generator.Function is deprecated, > please use pytest.Function instead * Minor fixes around s/py.test/pytest/
Diffstat (limited to 'paste/fixture.py')
-rw-r--r--paste/fixture.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/paste/fixture.py b/paste/fixture.py
index 8cff72f..cedf9a8 100644
--- a/paste/fixture.py
+++ b/paste/fixture.py
@@ -90,13 +90,14 @@ class Dummy_smtplib(object):
"SMTP connection not quit")
self.__class__.existing = None
+
class AppError(Exception):
pass
+
class TestApp(object):
- # for py.test
- disabled = True
+ __test__ = False # Ignore with pytest test collection.
def __init__(self, app, namespace=None, relative_to=None,
extra_environ=None, pre_request_hook=None,
@@ -189,8 +190,7 @@ class TestApp(object):
"""
if extra_environ is None:
extra_environ = {}
- # Hide from py.test:
- __tracebackhide__ = True
+ __tracebackhide__ = True # Hide from pytest:
if params:
if not isinstance(params, (six.binary_type, six.text_type)):
params = urlencode(params, doseq=True)
@@ -494,10 +494,10 @@ class CaptureStdout(object):
def getvalue(self):
return self.captured.getvalue()
+
class TestResponse(object):
- # for py.test
- disabled = True
+ __test__ = False # Ignore with pytest test collection.
"""
Instances of this class are return by `TestApp
@@ -884,10 +884,10 @@ class TestResponse(object):
url = 'file:' + fn.replace(os.sep, '/')
webbrowser.open_new(url)
+
class TestRequest(object):
- # for py.test
- disabled = True
+ __test__ = False # Ignore with pytest test collection.
"""
Instances of this class are created by `TestApp
@@ -1331,8 +1331,7 @@ class TestFileEnvironment(object):
scripts will be run.
"""
- # for py.test
- disabled = True
+ __test__ = False # Ignore with pytest test collection.
def __init__(self, base_path, template_path=None,
script_path=None,
@@ -1722,9 +1721,10 @@ def _make_pattern(pat):
assert 0, (
"Cannot make callable pattern object out of %r" % pat)
+
def setup_module(module=None):
"""
- This is used by py.test if it is in the module, so you can
+ This is used by pytest if it is in the module, so you can
import this directly.
Use like::