mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
55b7787ef5
With new Pytest 6.0 [0]: > PytestDeprecationWarning are now errors by default. Following our plan to remove deprecated features with as little disruption as possible, all warnings of type PytestDeprecationWarning now generate errors instead of warning messages. PytestWarnings are no longer marked as the part of public API, but as internal warnings. It's unsafe to use bare PytestDeprecationWarning, which is turned into the error on major releases. [0]: https://github.com/pytest-dev/pytest/releases/tag/6.0.0 Fixes: https://pagure.io/freeipa/issue/8435 Signed-off-by: Stanislav Levin <slev@altlinux.org> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
100 lines
2.3 KiB
Python
100 lines
2.3 KiB
Python
#
|
|
# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
|
|
#
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def ipa_testdir(testdir):
|
|
"""
|
|
Create conftest within testdir.
|
|
"""
|
|
testdir.makeconftest(
|
|
"""
|
|
pytest_plugins = ["ipatests.pytest_ipa.deprecated_frameworks"]
|
|
"""
|
|
)
|
|
return testdir
|
|
|
|
|
|
@pytest.fixture
|
|
def xunit_testdir(ipa_testdir):
|
|
"""
|
|
Create xnit style test module within testdir.
|
|
"""
|
|
ipa_testdir.makepyfile("""
|
|
def setup_module():
|
|
pass
|
|
def teardown_module():
|
|
pass
|
|
def setup_function():
|
|
pass
|
|
def teardown_function():
|
|
pass
|
|
|
|
class TestClass:
|
|
@classmethod
|
|
def setup_class(cls):
|
|
pass
|
|
@classmethod
|
|
def teardown_class(cls):
|
|
pass
|
|
def setup_method(self):
|
|
pass
|
|
def teardown_method(self):
|
|
pass
|
|
def test_m(self):
|
|
pass
|
|
""")
|
|
return ipa_testdir
|
|
|
|
|
|
@pytest.fixture
|
|
def unittest_testdir(ipa_testdir):
|
|
"""
|
|
Create unittest style test module within testdir.
|
|
"""
|
|
ipa_testdir.makepyfile("""
|
|
import unittest
|
|
def setUpModule():
|
|
pass
|
|
def tearDownModule():
|
|
pass
|
|
class TestClass(unittest.TestCase):
|
|
@classmethod
|
|
def setUp(self):
|
|
pass
|
|
def tearDown(self):
|
|
pass
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
pass
|
|
@classmethod
|
|
def tearDownClass(cls):
|
|
pass
|
|
def test_m(self):
|
|
pass
|
|
""")
|
|
return ipa_testdir
|
|
|
|
|
|
def test_xunit(xunit_testdir):
|
|
result = xunit_testdir.runpytest()
|
|
result.assert_outcomes(passed=1)
|
|
result.stdout.fnmatch_lines([
|
|
"* PytestIPADeprecationWarning: xunit style is deprecated in favour of "
|
|
"fixtures style",
|
|
"* 8 warning*",
|
|
])
|
|
|
|
|
|
def test_unittest(unittest_testdir):
|
|
result = unittest_testdir.runpytest()
|
|
result.assert_outcomes(passed=1)
|
|
result.stdout.fnmatch_lines([
|
|
"* PytestIPADeprecationWarning: unittest is deprecated in favour of "
|
|
"fixtures style",
|
|
"* 1 warning*",
|
|
])
|