summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-04-25 23:41:53 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2020-04-25 23:41:53 +0200
commit7081c894815c3d94ed3ddb2a633e7111a6700007 (patch)
tree01094e521d7515cf5525f9f869f1aafb558a26af
parente65383d258dcdac2491b5a7ec0d9b5e2eefae2ef (diff)
downloadpsutil-7081c894815c3d94ed3ddb2a633e7111a6700007.tar.gz
make test-by-name now has colors
-rwxr-xr-x.ci/travis/install.sh4
-rw-r--r--.cirrus.yml4
-rw-r--r--Makefile2
-rwxr-xr-xpsutil/tests/runner.py10
4 files changed, 11 insertions, 9 deletions
diff --git a/.ci/travis/install.sh b/.ci/travis/install.sh
index bda69289..f06e43d5 100755
--- a/.ci/travis/install.sh
+++ b/.ci/travis/install.sh
@@ -16,10 +16,6 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
fi
case "${PYVER}" in
- # py26)
- # pyenv install 2.6.9
- # pyenv virtualenv 2.6.9 psutil
- # ;;
py27)
pyenv install 2.7.16
pyenv virtualenv 2.7.16 psutil
diff --git a/.cirrus.yml b/.cirrus.yml
index cf424f27..129644c5 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -6,7 +6,7 @@ freebsd_13_py3_task:
install_script:
- pkg install -y python3 gcc py37-pip
script:
- - python3 -m pip install --user setuptools
+ - python3 -m pip install --user setuptools concurrencytest
- make clean
- make install
- make test-parallel
@@ -22,7 +22,7 @@ freebsd_11_py2_task:
install_script:
- pkg install -y python gcc py27-pip
script:
- - python2.7 -m pip install --user setuptools ipaddress mock
+ - python2.7 -m pip install --user setuptools ipaddress mock concurrencytest
- make clean
- make install
- make test-parallel
diff --git a/Makefile b/Makefile
index 13ff1b37..76420bc7 100644
--- a/Makefile
+++ b/Makefile
@@ -159,7 +159,7 @@ test-memleaks: ## Memory leak tests.
test-by-name: ## e.g. make test-by-name ARGS=psutil.tests.test_system.TestSystemAPIs
${MAKE} install
- @$(TEST_PREFIX) $(PYTHON) -m unittest -v $(ARGS)
+ @$(TEST_PREFIX) $(PYTHON) $(TSCRIPT) $(ARGS)
test-failed: ## Re-run tests which failed on last run
${MAKE} install
diff --git a/psutil/tests/runner.py b/psutil/tests/runner.py
index 5dcbe74b..7802588c 100755
--- a/psutil/tests/runner.py
+++ b/psutil/tests/runner.py
@@ -277,7 +277,7 @@ def _setup():
def main():
_setup()
- usage = "python3 -m psutil.tests [opts]"
+ usage = "python3 -m psutil.tests [opts] [test-name]"
parser = optparse.OptionParser(usage=usage, description="run unit tests")
parser.add_option("--last-failed",
action="store_true", default=False,
@@ -290,7 +290,13 @@ def main():
if not opts.last_failed:
safe_rmpath(FAILED_TESTS_FNAME)
- if opts.last_failed:
+ # test-by-name
+ if args:
+ if len(args) > 1:
+ parser.print_usage()
+ return sys.exit(1)
+ return runner.run_from_name(args[0])
+ elif opts.last_failed:
runner.run_last_failed()
elif not opts.parallel:
runner.run()