diff --git a/tests/test_ctl.py b/tests/test_ctl.py index c8c36d75c..c841b0883 100644 --- a/tests/test_ctl.py +++ b/tests/test_ctl.py @@ -438,13 +438,13 @@ def test_shell(): call_command('shell') # missing tenant name -class TestAfterJob(AfterJob): +class AfterJobForTest(AfterJob): def execute(self): self.test_result = WorkflowStatusItem().compute('{{ global_title|default:"FAIL" }}') self.l10n_month = WorkflowStatusItem().compute('{{ "10/10/2010"|date:"F" }}') -class TestExceptionAfterJob(AfterJob): +class AfterJobForTestWithException(AfterJob): def execute(self): raise ZeroDivisionError() @@ -462,7 +462,7 @@ def test_runjob(pub): with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd: pub.site_options.write(fd) - job = TestAfterJob(label='test') + job = AfterJobForTest(label='test') job.store() assert AfterJob.get(job.id).status == 'registered' call_command('runjob', '--domain=example.net', '--job-id=%s' % job.id) @@ -472,7 +472,7 @@ def test_runjob(pub): pub.cfg['language'] = {'language': 'fr'} pub.write_cfg() - job = TestAfterJob(label='test2') + job = AfterJobForTest(label='test2') job.store() assert AfterJob.get(job.id).status == 'registered' call_command('runjob', '--domain=example.net', '--job-id=%s' % job.id) @@ -489,7 +489,7 @@ def test_runjob(pub): assert AfterJob.get(job.id).completion_time != completion_time # test exception handling - job = TestExceptionAfterJob(label='test3') + job = AfterJobForTestWithException(label='test3') job.store() assert AfterJob.get(job.id).status == 'registered' call_command('runjob', '--domain=example.net', '--job-id=%s' % job.id) diff --git a/tox.ini b/tox.ini index 8e149de15..211772010 100644 --- a/tox.ini +++ b/tox.ini @@ -73,3 +73,7 @@ deps = commands = ./getlasso3.sh ./pylint.sh wcs/ tests/ + +[pytest] +filterwarnings = + error::_pytest.warning_types.PytestCollectionWarning diff --git a/wcs/testdef.py b/wcs/testdef.py index e704d787c..45f849311 100644 --- a/wcs/testdef.py +++ b/wcs/testdef.py @@ -36,6 +36,9 @@ class TestError(Exception): self.msg = msg self.error = error + # prevent pytest from trying to collect this class (#75521) + __test__ = False + class TestDef(sql.TestDef): _names = 'testdef'