/usr/lib/python2.7/dist-packages/mdp/test/__init__.py is in python-mdp 3.5-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | from builtins import str
import os
from mdp.configuration import _version_too_old
def test(filename=None, seed=None, options='', mod_loc=None):
"""Run tests.
filename -- only run tests in filename. If not set run all tests.
You do not need the full path, the relative path within the
test directory is enough.
seed -- set random seed
options -- options to be passed to py.test (as a string)
mod_loc -- don't use it, it's for internal usage
"""
if mod_loc is None:
mod_loc = os.path.dirname(__file__)
if filename is None:
loc = mod_loc
else:
loc = os.path.join(mod_loc, os.path.basename(filename))
args = []
if seed is not None:
args.append('--seed=' + str(seed))
# add --assert=reiterp option to work around permissions problem
# with __pycache__ directory when MDP is installed on a normal
# user non-writable directory
options = "--assert=reinterp "+options
args.extend(options.split())
args.append(loc)
_worker = get_worker()
return _worker(args)
def get_worker():
try:
import py.test
except ImportError:
raise ImportError('You need py.test to run the test suite!')
# check that we have at least version 2.1.2
if _version_too_old(py.test.__version__, (2,1,2)):
raise ImportError('You need at least py.test version 2.1.2,'
' found %s!'%py.test.__version__)
else:
return py.test.cmdline.main
|