golden hour
/lib64/python2.7/site-packages/psutil/tests
⬆️ Go Up
Upload
File/Folder
Size
Actions
__init__.py
34.28 KB
Del
OK
__init__.pyc
34.08 KB
Del
OK
__init__.pyo
33.3 KB
Del
OK
__main__.py
2.65 KB
Del
OK
__main__.pyc
3.17 KB
Del
OK
__main__.pyo
3.17 KB
Del
OK
runner.py
5.61 KB
Del
OK
runner.pyc
7.57 KB
Del
OK
runner.pyo
7.46 KB
Del
OK
test_aix.py
4.36 KB
Del
OK
test_aix.pyc
3.94 KB
Del
OK
test_aix.pyo
3.94 KB
Del
OK
test_bsd.py
20.1 KB
Del
OK
test_bsd.pyc
23.55 KB
Del
OK
test_bsd.pyo
23.55 KB
Del
OK
test_connections.py
24.46 KB
Del
OK
test_connections.pyc
21.85 KB
Del
OK
test_connections.pyo
21.21 KB
Del
OK
test_contracts.py
23.15 KB
Del
OK
test_contracts.pyc
28.54 KB
Del
OK
test_contracts.pyo
27.42 KB
Del
OK
test_linux.py
86.29 KB
Del
OK
test_linux.pyc
81.64 KB
Del
OK
test_linux.pyo
80.14 KB
Del
OK
test_memory_leaks.py
17.94 KB
Del
OK
test_memory_leaks.pyc
27.39 KB
Del
OK
test_memory_leaks.pyo
27.39 KB
Del
OK
test_misc.py
37.84 KB
Del
OK
test_misc.pyc
42.78 KB
Del
OK
test_misc.pyo
41.52 KB
Del
OK
test_osx.py
9.04 KB
Del
OK
test_osx.pyc
12.78 KB
Del
OK
test_osx.pyo
12.78 KB
Del
OK
test_posix.py
16.17 KB
Del
OK
test_posix.pyc
16.3 KB
Del
OK
test_posix.pyo
16.17 KB
Del
OK
test_process.py
61.87 KB
Del
OK
test_process.pyc
51.23 KB
Del
OK
test_process.pyo
50.26 KB
Del
OK
test_sunos.py
1.26 KB
Del
OK
test_sunos.pyc
1.79 KB
Del
OK
test_sunos.pyo
1.79 KB
Del
OK
test_system.py
34.71 KB
Del
OK
test_system.pyc
31.46 KB
Del
OK
test_system.pyo
29.74 KB
Del
OK
test_unicode.py
12.78 KB
Del
OK
test_unicode.pyc
13.2 KB
Del
OK
test_unicode.pyo
13.14 KB
Del
OK
test_windows.py
33.47 KB
Del
OK
test_windows.pyc
35.48 KB
Del
OK
test_windows.pyo
35.22 KB
Del
OK
Edit: __main__.py
#!/usr/bin/env python # Copyright (c) 2009, Giampaolo Rodola'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Run unit tests. This is invoked by: $ python -m psutil.tests """ import contextlib import optparse import os import sys import tempfile try: from urllib.request import urlopen # py3 except ImportError: from urllib2 import urlopen from psutil.tests import PYTHON_EXE from psutil.tests.runner import run HERE = os.path.abspath(os.path.dirname(__file__)) GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py" TEST_DEPS = [] if sys.version_info[:2] == (2, 6): TEST_DEPS.extend(["ipaddress", "unittest2", "argparse", "mock==1.0.1"]) elif sys.version_info[:2] == (2, 7) or sys.version_info[:2] <= (3, 2): TEST_DEPS.extend(["ipaddress", "mock"]) def install_pip(): try: import pip # NOQA except ImportError: import ssl f = tempfile.NamedTemporaryFile(suffix='.py') with contextlib.closing(f): print("downloading %s to %s" % (GET_PIP_URL, f.name)) if hasattr(ssl, '_create_unverified_context'): ctx = ssl._create_unverified_context() else: ctx = None kwargs = dict(context=ctx) if ctx else {} req = urlopen(GET_PIP_URL, **kwargs) data = req.read() f.write(data) f.flush() print("installing pip") code = os.system('%s %s --user' % (PYTHON_EXE, f.name)) return code def install_test_deps(deps=None): """Install test dependencies via pip.""" if deps is None: deps = TEST_DEPS deps = set(deps) if deps: is_venv = hasattr(sys, 'real_prefix') opts = "--user" if not is_venv else "" install_pip() code = os.system('%s -m pip install %s --upgrade %s' % ( PYTHON_EXE, opts, " ".join(deps))) return code def main(): usage = "%s -m psutil.tests [opts]" % PYTHON_EXE parser = optparse.OptionParser(usage=usage, description="run unit tests") parser.add_option("-i", "--install-deps", action="store_true", default=False, help="don't print status messages to stdout") opts, args = parser.parse_args() if opts.install_deps: install_pip() install_test_deps() else: for dep in TEST_DEPS: try: __import__(dep.split("==")[0]) except ImportError: sys.exit("%r lib is not installed; run %s -m psutil.tests " "--install-deps" % (dep, PYTHON_EXE)) run() main()
Save