py.test 5.4.0 emits deprecation warnings for pytest.Class.
make sure we don't raise for these, and log the code that will
be used for 5.4.0 when we bump requirements.
Fixes: #668
Change-Id: I83e0402c4a6b2365a63b58d052c6989df3a37328
from sqlalchemy.testing.plugin.plugin_base import * # noqa
from sqlalchemy.testing.plugin.plugin_base import post
+from sqlalchemy.testing.plugin.plugin_base import post_begin as sqla_post_begin
from sqlalchemy.testing.plugin.plugin_base import stop_test_class as sqla_stc
py3k = sys.version_info >= (3, 0)
+
if py3k:
ABC = abc.ABC
__metaclass__ = abc.ABCMeta
+def post_begin():
+ sqla_post_begin()
+
+ import warnings
+
+ try:
+ import pytest
+ except ImportError:
+ pass
+ else:
+ warnings.filterwarnings(
+ "once", category=pytest.PytestDeprecationWarning
+ )
+
+
# override selected SQLAlchemy pytest hooks with vendored functionality
def stop_test_class(cls):
sqla_stc(cls)
def pytest_pycollect_makeitem(collector, name, obj):
if inspect.isclass(obj) and plugin_base.want_class(name, obj):
+
+ # in pytest 5.4.0
+ # return [
+ # pytest.Class.from_parent(collector,
+ # name=parametrize_cls.__name__)
+ # for parametrize_cls in _parametrize_cls(collector.module, obj)
+ # ]
+
return [
pytest.Class(parametrize_cls.__name__, parent=collector)
for parametrize_cls in _parametrize_cls(collector.module, obj)
--- /dev/null
+.. change::
+ :tags: bug, tests
+ :tickets: 668
+
+ Fixed an issue that prevented the test suite from running with the
+ recently released py.test 5.4.0.
+