summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2015-06-04 02:45:50 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2015-06-04 02:45:50 +0200
commit82da82a6bb94ed5c6faf9d762ef4ad0fec18f01b (patch)
treebdda30b50af97c1864e3c27f6ce7de04d953a786
parent5224920f72434e2306f83898c01dd2db9f41e744 (diff)
downloadpsutil-82da82a6bb94ed5c6faf9d762ef4ad0fec18f01b.tar.gz
add 'make coverage' and 'make install-dev-deps'
-rw-r--r--.travis.yml8
-rw-r--r--Makefile18
2 files changed, 22 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml
index aaca6dbe..c4085bc8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,10 +7,10 @@ python:
- 3.4
# - pypy
install:
- - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install ipaddress unittest2 mock; fi
- - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install ipaddress mock; fi
- - if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then pip install ipaddress mock; fi
- - if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then pip install ipaddress; fi
+ - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install -U ipaddress unittest2 mock; fi
+ - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install -U ipaddress mock; fi
+ - if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then pip install -U ipaddress mock; fi
+ - if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then pip install -U ipaddress; fi
script:
- pip install flake8 pep8
- python setup.py build
diff --git a/Makefile b/Makefile
index 510d7313..b13547c8 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,9 @@
PYTHON = python
TSCRIPT = test/test_psutil.py
+# Private vars
+COVERAGE_OPTS = --include="*psutil*" --omit="test/*,*setup*"
+
all: test
clean:
@@ -19,10 +22,12 @@ clean:
rm -rf *.core
rm -rf *.egg-info
rm -rf *\$testfile*
+ rm -rf .coverage
rm -rf .tox
rm -rf build
rm -rf dist
rm -rf docs/_build
+ rm -rf htmlcov
build: clean
$(PYTHON) setup.py build
@@ -31,6 +36,11 @@ build: clean
@# this directory.
$(PYTHON) setup.py build_ext -i
+install-dev-deps:
+ $(PYTHON) -m pip install --user --upgrade pip
+ $(PYTHON) -m pip install --user --upgrade \
+ ipaddress unittest2 mock ipdb coverage nose
+
install: build
$(PYTHON) setup.py install --user; \
@@ -59,6 +69,14 @@ test-by-name: install
test-memleaks-by-name: install
@$(PYTHON) -m nose test/test_memory_leaks.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))
+coverage: install
+ rm -rf .coverage htmlcov
+ $(PYTHON) -m coverage run $(TSCRIPT) $(COVERAGE_OPTS)
+ $(PYTHON) -m coverage report $(COVERAGE_OPTS)
+ @echo "writing results to htmlcov/index.html"
+ $(PYTHON) -m coverage html $(COVERAGE_OPTS)
+ $(PYTHON) -m webbrowser -t htmlcov/index.html
+
# requires "pip install pep8"
pep8:
@git ls-files | grep \\.py$ | xargs $(PYTHON) -m pep8