diff --git a/runtests.py b/runtests.py
index <HASH>..<HASH> 100644
--- a/runtests.py
+++ b/runtests.py
@@ -8,8 +8,10 @@
 File for running tests programmatically.
 """
 
+# Standard library imports
+import sys
+
 # Third party imports
-import qtpy
 import pytest
 
 
@@ -17,9 +19,9 @@ def main():
     """
     Run pytest tests.
     """
-    pytest.main(['-x', 'spyderlib',  '-v', '-rw', '--durations=10',
-                 '--cov=spyderlib', '--cov-report=term-missing'])
-
+    errno = pytest.main(['-x', 'spyderlib',  '-v', '-rw', '--durations=10',
+                         '--cov=spyderlib', '--cov-report=term-missing'])
+    sys.exit(errno)
 
 if __name__ == '__main__':
     main()
Tests: Exit runtests.py with error code from py.test

This allows CI tools to notice when tests fail.