Commit e48145b9 authored by Jérome Perrin's avatar Jérome Perrin

ERP5TypeTestSuite/SavedTestSuite: don't run tests when setup fail

If there's an error during the --save setup, we don't need to run
the --load steps, because test failed already and if they don't
fail in --load step, it would be a case where some errors are not
reported.
parent f279efa7
Pipeline #26255 failed with stage
...@@ -149,6 +149,7 @@ class SavedTestSuite(ERP5TypeTestSuite): ...@@ -149,6 +149,7 @@ class SavedTestSuite(ERP5TypeTestSuite):
# Use same portal id for all tests run by current instance # Use same portal id for all tests run by current instance
# but keep it (per-run) random. # but keep it (per-run) random.
self._portal_id = 'portal_%i' % (random.randint(0, sys.maxint), ) self._portal_id = 'portal_%i' % (random.randint(0, sys.maxint), )
self._setup_failed = False
super(SavedTestSuite, self).__init__(*args, **kw) super(SavedTestSuite, self).__init__(*args, **kw)
def getLogDirectoryPath(self, *args, **kw): def getLogDirectoryPath(self, *args, **kw):
...@@ -164,13 +165,22 @@ class SavedTestSuite(ERP5TypeTestSuite): ...@@ -164,13 +165,22 @@ class SavedTestSuite(ERP5TypeTestSuite):
*args, **kw) *args, **kw)
def runUnitTest(self, *args, **kw): def runUnitTest(self, *args, **kw):
if self._setup_failed:
return self._setup_failed
return self.__runUnitTest( return self.__runUnitTest(
'--load', '--load',
*args, **kw) *args, **kw)
def setup(self): def setup(self):
super(SavedTestSuite, self).setup() super(SavedTestSuite, self).setup()
self.__runUnitTest('--save', self._saved_test_id) status_dict = self.__runUnitTest(
'--save', self._saved_test_id)
if status_dict['status_code']:
status_dict['stderr'] = \
b'Not running tests because setup failed\n' \
+ status_dict['stderr']
self._setup_failed = status_dict
sys.modules['test_suite'] = module = imp.new_module('test_suite') sys.modules['test_suite'] = module = imp.new_module('test_suite')
for var in SubprocessError, TestSuite, ERP5TypeTestSuite, ProjectTestSuite, \ for var in SubprocessError, TestSuite, ERP5TypeTestSuite, ProjectTestSuite, \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment