jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] script_tests: Test for exit code later ......................................................................
[IMPROV] script_tests: Test for exit code later
As the test for exit code is not very descriptive it should do the tests for the output first (which show the output when there is a problem).
Change-Id: Ic5100fe595baa49337c08f8c30b7bd68c4c63f87 --- M tests/script_tests.py 1 file changed, 5 insertions(+), 3 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/script_tests.py b/tests/script_tests.py index dd44df3..5731006 100644 --- a/tests/script_tests.py +++ b/tests/script_tests.py @@ -253,7 +253,7 @@ if error: self.assertIn(error, result['stderr'])
- self.assertIn(result['exit_code'], [0, 1, 2, -9]) + exit_codes = [0, 1, 2, -9] else: if stderr_other == ['']: stderr_other = None @@ -261,10 +261,10 @@ self.assertIn('Global arguments available for all', result['stdout'])
- self.assertEqual(result['exit_code'], 0) + exit_codes = [0] else: # auto-run - self.assertIn(result['exit_code'], [0, -9]) + exit_codes = [0, -9]
if (not result['stdout'] and not result['stderr']): print(' auto-run script unresponsive after %d seconds' @@ -292,6 +292,8 @@ result['stdout'] = None self.assertIsNone(result['stdout'])
+ self.assertIn(result['exit_code'], exit_codes) + sys.stdout.flush()
return testScript
pywikibot-commits@lists.wikimedia.org