Unittest - Skip tests that use faketime if not available

This commit is contained in:
Renato Alves 2014-07-18 17:20:27 +01:00
parent fdbb8e02f0
commit 00ee5b2289
2 changed files with 6 additions and 2 deletions

View file

@ -4,7 +4,8 @@ import os
import tempfile import tempfile
import shutil import shutil
import atexit import atexit
from .utils import run_cmd_wait, run_cmd_wait_nofail import unittest
from .utils import run_cmd_wait, run_cmd_wait_nofail, which
from .exceptions import CommandError from .exceptions import CommandError
@ -242,7 +243,9 @@ class Task(object):
If faketime is None, faketime settings will be disabled. If faketime is None, faketime settings will be disabled.
""" """
cmd = "faketime" cmd = which("faketime")
if cmd is None:
raise unittest.SkipTest("libfaketime/faketime is not installed")
if self._command[0] == cmd: if self._command[0] == cmd:
self._command = self._command[3:] self._command = self._command[3:]

View file

@ -4,6 +4,7 @@ import os
import sys import sys
import socket import socket
import signal import signal
import functools
from subprocess import Popen, PIPE, STDOUT from subprocess import Popen, PIPE, STDOUT
from threading import Thread from threading import Thread
from Queue import Queue, Empty from Queue import Queue, Empty