python: tests: Allow some tests to be skipped.

Currently test820RHBZ912499.py fails with libvirt because libvirt
still doesn't work around qemu locking properly.  Allow this test to
be skipped on a temporary basis using SKIP_TEST820RHBZ912499_PY=1
This commit is contained in:
Richard W.M. Jones
2017-10-18 18:07:19 +01:00
parent 8295e44004
commit f3330e144b
2 changed files with 12 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ from .tests_helper import *
# If the architecture doesn't support IDE, skip the test.
@skipIfEnvironmentVariableSet("SKIP_TEST820RHBZ912499_PY")
@skipUnlessArchMatches("(i.86|x86_64)")
@skipUnlessGuestfsBackendIs('libvirt')
@skipUnlessLibvirtHasCPointer()

View File

@@ -18,6 +18,7 @@
# Utilities for the tests of the Python bindings.
import os
import sys
import unittest
@@ -28,6 +29,16 @@ else:
int_type = long
def skipIfEnvironmentVariableSet(name):
"""
Skip the current class/method if the named environment variable
is set to 1
"""
if os.environ.get(name, "") == "1":
return unittest.skip("skipped by environment variable")
return lambda func: func
def skipUnlessConfiguredWithLibvirt():
"""
Skip the current class/method if ./configure --without-libvirt