""" Run planned tests. """
planned = len(self.tests)
passed = 0
+ if planned == 0:
+ return
print('[==========] Running %d test(s).' % planned)
for name, test_callback, args in self.tests:
except Exception as e:
print('[ FAIL ] %s (%s)' % (name, str(e)))
+ # Clear test set
+ self.tests = []
print('[==========] %d test(s) run.' % planned)
if passed == planned:
print('[ PASSED ] %d test(s).' % passed)
return 0
else:
print('[ FAILED ] %d test(s).' % (planned - passed))
- return 1
+ return 1
\ No newline at end of file
if __name__ == '__main__':
# Self-test code
- if '--test' in sys.argv:
- test = test.Test()
- test.add('testserver/sendrecv', test_sendrecv)
- sys.exit(test.run())
+ test = test.Test()
+ test.add('testserver/sendrecv', test_sendrecv)
+ if test.run() != 0:
+ sys.exit(1)
# Mirror server
server = TestServer(None, socket.AF_INET, '127.0.0.1')
- print('mirror server running at %s' % str(server.address()))
+ print('[==========] Mirror server running at %s' % str(server.address()))
try:
server.run()
except KeyboardInterrupt:
- pass
+ print('[==========] Shutdown.')
+ pass
server.stop()
if __name__ == '__main__':
+ # Self-tests first
test = test.Test()
-
- # Self-test code
- if '--test' in sys.argv:
- test.add('integration/ipc', test_ipc)
+ test.add('integration/ipc', test_ipc)
+ if test.run() != 0:
+ sys.exit(1)
else:
# Scan for scenarios
for arg in sys.argv[1:]:
objects = find_objects(arg)
for path in objects:
test.add(path, play_object, path)
-
- sys.exit(test.run())
+ sys.exit(test.run())