tests: fix PytestCollectionWarning (#75521) #170
|
@ -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)
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -73,3 +73,7 @@ deps =
|
|||
commands =
|
||||
./getlasso3.sh
|
||||
./pylint.sh wcs/ tests/
|
||||
|
||||
[pytest]
|
||||
filterwarnings =
|
||||
error::_pytest.warning_types.PytestCollectionWarning
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue