virtual-image: Re-run the test using the defined wrapper if any

In case a LIBFPRINT_TEST_WRAPPER is defined, execute again the script using
the same python processor but using the passed wrapper command.
This commit is contained in:
Marco Trevisan (Treviño) 2019-11-26 19:37:55 +01:00
parent 19a50cfdc3
commit 222c33ec32

View file

@ -10,11 +10,20 @@ import sys
import unittest import unittest
import socket import socket
import struct import struct
import subprocess
import shutil import shutil
import glob import glob
import cairo import cairo
import tempfile import tempfile
# Re-run the test with the passed wrapper if set
wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER')
if wrapper:
wrap_cmd = wrapper.split(' ') + [sys.executable, os.path.abspath(__file__)] + \
sys.argv[1:]
os.unsetenv('LIBFPRINT_TEST_WRAPPER')
sys.exit(subprocess.check_call(wrap_cmd))
class Connection: class Connection:
def __init__(self, addr): def __init__(self, addr):
@ -274,7 +283,6 @@ class VirtualImage(unittest.TestCase):
ctx.iteration(True) ctx.iteration(True)
assert(not self._verify_match) assert(not self._verify_match)
# avoid writing to stderr # avoid writing to stderr
unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2)) unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2))