Skip to content

Commit

Permalink
make test-by-name now has colors
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Apr 25, 2020
1 parent e65383d commit 7081c89
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
4 changes: 0 additions & 4 deletions .ci/travis/install.sh
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .cirrus.yml
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions psutil/tests/runner.py
Expand Up @@ -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,
Expand All @@ -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()
Expand Down

0 comments on commit 7081c89

Please sign in to comment.