add shell script to run all python tests and automatically handle Xvfb
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Sat, 16 Sep 2017 21:26:17 +0300
changeset 1820 76f5eba31afd
parent 1819 27976d1606a4
child 1821 44a47d255d36
add shell script to run all python tests and automatically handle Xvfb
bitbucket-pipelines.yml
tests/tools/run_python_tests.sh
--- a/bitbucket-pipelines.yml	Sat Sep 16 21:24:22 2017 +0300
+++ b/bitbucket-pipelines.yml	Sat Sep 16 21:26:17 2017 +0300
@@ -7,16 +7,13 @@
             script: # Modify the commands below to build your repository.
               - /usr/bin/python --version
               - ./tests/tools/check_source.sh
-              - Xvfb :42 -screen 0 1280x1024x24 &
-              - DISPLAY=:42 pytest --timeout=10 ./tests/tools
-              - pkill -9 Xvfb
+              - ./tests/tools/run_python_tests.sh
+
 
   default:
     - step:
         script: # Modify the commands below to build your repository.
           - /usr/bin/python --version
-          - ./tests/tools/check_source.sh
-          - Xvfb :42 -screen 0 1280x1024x24 &
-          - DISPLAY=:42 pytest --timeout=10 ./tests/tools
-          - pkill -9 Xvfb
+          - ./tests/tools/check_source.sh 
+          - ./tests/tools/run_python_tests.sh         
           
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tools/run_python_tests.sh	Sat Sep 16 21:26:17 2017 +0300
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+
+export DISPLAY=:42
+Xvfb $DISPLAY -screen 0 1280x1024x24 &
+sleep 1
+
+ret=0
+DELAY=400
+KILL_DELAY=$(($DELAY + 30))
+timeout -k $KILL_DELAY $DELAY pytest --timeout=10 ./tests/tools
+ret=$?
+
+pkill -9 Xvfb
+
+exit $ret