Skip to content
Snippets Groups Projects

Return non zero code on failure

Merged Bryan Brancotte requested to merge fail-ci-on-test-failure into main
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
+ 3
3
@@ -4,13 +4,13 @@ import unittest
# Run all tests
def main(args=None):
def main(pattern='test_*.py', *args):
test_loader = unittest.TestLoader()
test_suite = test_loader.discover('tests', pattern='test_*.py')
test_suite = test_loader.discover('tests', pattern=pattern)
runner = unittest.TextTestRunner()
results = runner.run(test_suite)
return results.wasSuccessful()
if __name__ == '__main__':
sys.exit(0 if main(sys.argv[1:]) else 1)
sys.exit(0 if main(*sys.argv[1:]) else 1)
Loading