tests: fix PytestCollectionWarning (#75521) #170
|
@ -438,13 +438,13 @@ def test_shell():
|
||||||
call_command('shell') # missing tenant name
|
call_command('shell') # missing tenant name
|
||||||
|
|
||||||
|
|
||||||
class TestAfterJob(AfterJob):
|
class AfterJobForTest(AfterJob):
|
||||||
def execute(self):
|
def execute(self):
|
||||||
self.test_result = WorkflowStatusItem().compute('{{ global_title|default:"FAIL" }}')
|
self.test_result = WorkflowStatusItem().compute('{{ global_title|default:"FAIL" }}')
|
||||||
self.l10n_month = WorkflowStatusItem().compute('{{ "10/10/2010"|date:"F" }}')
|
self.l10n_month = WorkflowStatusItem().compute('{{ "10/10/2010"|date:"F" }}')
|
||||||
|
|
||||||
|
|
||||||
class TestExceptionAfterJob(AfterJob):
|
class AfterJobForTestWithException(AfterJob):
|
||||||
def execute(self):
|
def execute(self):
|
||||||
raise ZeroDivisionError()
|
raise ZeroDivisionError()
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ def test_runjob(pub):
|
||||||
with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
|
with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
|
||||||
pub.site_options.write(fd)
|
pub.site_options.write(fd)
|
||||||
|
|
||||||
job = TestAfterJob(label='test')
|
job = AfterJobForTest(label='test')
|
||||||
job.store()
|
job.store()
|
||||||
assert AfterJob.get(job.id).status == 'registered'
|
assert AfterJob.get(job.id).status == 'registered'
|
||||||
call_command('runjob', '--domain=example.net', '--job-id=%s' % job.id)
|
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.cfg['language'] = {'language': 'fr'}
|
||||||
pub.write_cfg()
|
pub.write_cfg()
|
||||||
job = TestAfterJob(label='test2')
|
job = AfterJobForTest(label='test2')
|
||||||
job.store()
|
job.store()
|
||||||
assert AfterJob.get(job.id).status == 'registered'
|
assert AfterJob.get(job.id).status == 'registered'
|
||||||
call_command('runjob', '--domain=example.net', '--job-id=%s' % job.id)
|
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
|
assert AfterJob.get(job.id).completion_time != completion_time
|
||||||
|
|
||||||
# test exception handling
|
# test exception handling
|
||||||
job = TestExceptionAfterJob(label='test3')
|
job = AfterJobForTestWithException(label='test3')
|
||||||
job.store()
|
job.store()
|
||||||
assert AfterJob.get(job.id).status == 'registered'
|
assert AfterJob.get(job.id).status == 'registered'
|
||||||
call_command('runjob', '--domain=example.net', '--job-id=%s' % job.id)
|
call_command('runjob', '--domain=example.net', '--job-id=%s' % job.id)
|
||||||
|
|
4
tox.ini
4
tox.ini
|
@ -73,3 +73,7 @@ deps =
|
||||||
commands =
|
commands =
|
||||||
./getlasso3.sh
|
./getlasso3.sh
|
||||||
./pylint.sh wcs/ tests/
|
./pylint.sh wcs/ tests/
|
||||||
|
|
||||||
|
[pytest]
|
||||||
|
filterwarnings =
|
||||||
|
error::_pytest.warning_types.PytestCollectionWarning
|
||||||
|
|
|
@ -36,6 +36,9 @@ class TestError(Exception):
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
self.error = error
|
self.error = error
|
||||||
|
|
||||||
|
# prevent pytest from trying to collect this class (#75521)
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
|
|
||||||
class TestDef(sql.TestDef):
|
class TestDef(sql.TestDef):
|
||||||
_names = 'testdef'
|
_names = 'testdef'
|
||||||
|
|
Loading…
Reference in New Issue