/usr/local/lib/python3.6/site-packages/joblib
NameSizeModeActions
externals/-0755rm
test/-0755rm
__pycache__/-0755rm
backports.py27780644editdlrm
compressor.py197700644editdlrm
disk.py43860644editdlrm
executor.py53160644editdlrm
format_stack.py10450644editdlrm
func_inspect.py139450644editdlrm
hashing.py105360644editdlrm
logger.py51290644editdlrm
memory.py417770644editdlrm
my_exceptions.py9620644editdlrm
numpy_pickle.py234980644editdlrm
numpy_pickle_compat.py85480644editdlrm
numpy_pickle_utils.py87060644editdlrm
parallel.py469460644editdlrm
pool.py143340644editdlrm
testing.py21800644editdlrm
_cloudpickle_wrapper.py3760644editdlrm
_dask.py129320644editdlrm
_deprecated_format_stack.py145050644editdlrm
_deprecated_my_exceptions.py41340644editdlrm
_memmapping_reducer.py280690644editdlrm
_multiprocessing_helpers.py18850644editdlrm
_parallel_backends.py238050644editdlrm
_store_backends.py144350644editdlrm
_utils.py11160644editdlrm
__init__.py49930644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/joblib/testing.py (2180B)
""" Helper for testing. """ import sys import warnings import os.path import re import subprocess import threading import pytest import _pytest raises = pytest.raises warns = pytest.warns SkipTest = _pytest.runner.Skipped skipif = pytest.mark.skipif fixture = pytest.fixture parametrize = pytest.mark.parametrize timeout = pytest.mark.timeout xfail = pytest.mark.xfail param = pytest.param def warnings_to_stdout(): """ Redirect all warnings to stdout. """ showwarning_orig = warnings.showwarning def showwarning(msg, cat, fname, lno, file=None, line=0): showwarning_orig(msg, cat, os.path.basename(fname), line, sys.stdout) warnings.showwarning = showwarning # warnings.simplefilter('always') def check_subprocess_call(cmd, timeout=5, stdout_regex=None, stderr_regex=None): """Runs a command in a subprocess with timeout in seconds. Also checks returncode is zero, stdout if stdout_regex is set, and stderr if stderr_regex is set. """ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) def kill_process(): warnings.warn("Timeout running {}".format(cmd)) proc.kill() timer = threading.Timer(timeout, kill_process) try: timer.start() stdout, stderr = proc.communicate() stdout, stderr = stdout.decode(), stderr.decode() if proc.returncode != 0: message = ( 'Non-zero return code: {}.\nStdout:\n{}\n' 'Stderr:\n{}').format( proc.returncode, stdout, stderr) raise ValueError(message) if (stdout_regex is not None and not re.search(stdout_regex, stdout)): raise ValueError( "Unexpected stdout: {!r} does not match:\n{!r}".format( stdout_regex, stdout)) if (stderr_regex is not None and not re.search(stderr_regex, stderr)): raise ValueError( "Unexpected stderr: {!r} does not match:\n{!r}".format( stderr_regex, stderr)) finally: timer.cancel()