Unittest - Skip tests that use faketime if not available
This commit is contained in:
@@ -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:]
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user