Преглед на файлове

More cleanup of the test runner

Steven Silvester преди 8 години
родител
ревизия
67a2a95c62
променени са 1 файла, в които са добавени 8 реда и са изтрити 5 реда
  1. 8 5
      test/run-test.py

+ 8 - 5
test/run-test.py

@@ -55,8 +55,9 @@ def create_notebook_dir():
 
 @gen.coroutine
 def run(cmd):
-    """Start the task."""
-    """Run a task in a thread and exit with the return code."""
+    """Run the cmd and exit with the return code"""
+    yield gen.moment  # sync up with the ioloop
+
     shell = os.name == 'nt'
     proc = Popen(cmd, shell=shell)
     print('\n\nRunning command: "%s"\n\n' % ' '.join(cmd))
@@ -71,10 +72,11 @@ def run(cmd):
 
 
 @gen.coroutine
-def exit(returncode):
+def exit(code):
     """Safely stop the app and then exit with the given code."""
+    yield gen.moment   # sync up with the ioloop
     IOLoop.current().stop()
-    sys.exit(returncode)
+    sys.exit(code)
 
 
 class TestApp(NotebookApp):
@@ -96,7 +98,8 @@ def main():
         sys.exit(1)
 
     app.initialize([])  # reserve sys.argv for the command
-    run(get_command(app))
+    cmd = get_command(app)
+    run(cmd)
 
     try:
         app.start()