summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-05-10 20:38:05 +0200
committerGitHub <noreply@github.com>2017-05-10 20:38:05 +0200
commit58aef46d74ff577f60eb9e0478d6de3361c8a4e9 (patch)
treefea3e3cf33de981dd1d54d12cb7f718876d3b244 /Makefile
parent596b43381711248093caf1c1df3b5d93d0c70bb6 (diff)
downloadpsutil-58aef46d74ff577f60eb9e0478d6de3361c8a4e9.tar.gz
1058 enable fix warnings (#1059)
* #1058: have Makefile use PYTHONWARNINGS=all by default for (almost) all commands * #1058 fix linux tests warnings * #1058: try not to use imp module * #1058: get rid of imp module completely * #1058: ignore unicode warnings * #1058: ignore stderr from procsmem.py * #1058: fix resource warning from Popen * #1058: get rid of contextlib.nested (deprecated)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile56
1 files changed, 28 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 953225e3..12469d4c 100644
--- a/Makefile
+++ b/Makefile
@@ -63,11 +63,11 @@ _:
# Compile without installing.
build: _
- $(PYTHON) setup.py build
+ PYTHONWARNINGS=all $(PYTHON) setup.py build
@# copies compiled *.so files in ./psutil directory in order to allow
@# "import psutil" when using the interactive interpreter from within
@# this directory.
- $(PYTHON) setup.py build_ext -i
+ PYTHONWARNINGS=all $(PYTHON) setup.py build_ext -i
rm -rf tmp
# Install this package + GIT hooks. Install is done:
@@ -77,7 +77,7 @@ install:
${MAKE} build
# make sure setuptools is installed (needed for 'develop' / edit mode)
$(PYTHON) -c "import setuptools"
- $(PYTHON) setup.py develop $(INSTALL_OPTS)
+ PYTHONWARNINGS=all $(PYTHON) setup.py develop $(INSTALL_OPTS)
rm -rf tmp
# Uninstall this package via pip.
@@ -86,7 +86,7 @@ uninstall:
# Install PIP (only if necessary).
install-pip:
- $(PYTHON) -c \
+ PYTHONWARNINGS=all $(PYTHON) -c \
"import sys, ssl, os, pkgutil, tempfile, atexit; \
sys.exit(0) if pkgutil.find_loader('pip') else None; \
pyexc = 'from urllib.request import urlopen' if sys.version_info[0] == 3 else 'from urllib2 import urlopen'; \
@@ -118,65 +118,65 @@ setup-dev-env:
# Run all tests.
test:
${MAKE} install
- $(PYTHON) $(TSCRIPT)
+ PYTHONWARNINGS=all $(PYTHON) $(TSCRIPT)
# Run process-related API tests.
test-process:
${MAKE} install
- $(PYTHON) -m unittest -v psutil.tests.test_process
+ PYTHONWARNINGS=all $(PYTHON) -m unittest -v psutil.tests.test_process
# Run system-related API tests.
test-system:
${MAKE} install
- $(PYTHON) -m unittest -v psutil.tests.test_system
+ PYTHONWARNINGS=all $(PYTHON) -m unittest -v psutil.tests.test_system
# Run miscellaneous tests.
test-misc:
${MAKE} install
- $(PYTHON) psutil/tests/test_misc.py
+ PYTHONWARNINGS=all $(PYTHON) psutil/tests/test_misc.py
# Test APIs dealing with strings.
test-unicode:
${MAKE} install
- $(PYTHON) psutil/tests/test_unicode.py
+ PYTHONWARNINGS=all $(PYTHON) psutil/tests/test_unicode.py
# APIs sanity tests.
test-contracts:
${MAKE} install
- $(PYTHON) psutil/tests/test_contracts.py
+ PYTHONWARNINGS=all $(PYTHON) psutil/tests/test_contracts.py
# Test net_connections() and Process.connections().
test-connections:
${MAKE} install
- $(PYTHON) psutil/tests/test_connections.py
+ PYTHONWARNINGS=all $(PYTHON) psutil/tests/test_connections.py
# POSIX specific tests.
test-posix:
${MAKE} install
- $(PYTHON) psutil/tests/test_posix.py
+ PYTHONWARNINGS=all $(PYTHON) psutil/tests/test_posix.py
# Run specific platform tests only.
test-platform:
${MAKE} install
- $(PYTHON) psutil/tests/test_`$(PYTHON) -c 'import psutil; print([x.lower() for x in ("LINUX", "BSD", "OSX", "SUNOS", "WINDOWS") if getattr(psutil, x)][0])'`.py
+ PYTHONWARNINGS=all $(PYTHON) psutil/tests/test_`$(PYTHON) -c 'import psutil; print([x.lower() for x in ("LINUX", "BSD", "OSX", "SUNOS", "WINDOWS") if getattr(psutil, x)][0])'`.py
# Memory leak tests.
test-memleaks:
${MAKE} install
- $(PYTHON) psutil/tests/test_memory_leaks.py
+ PYTHONWARNINGS=all $(PYTHON) psutil/tests/test_memory_leaks.py
# Run a specific test by name, e.g.
# make test-by-name psutil.tests.test_system.TestSystemAPIs.test_cpu_times
test-by-name:
${MAKE} install
- @$(PYTHON) -m unittest -v $(ARGS)
+ @PYTHONWARNINGS=all $(PYTHON) -m unittest -v $(ARGS)
# Run test coverage.
coverage:
${MAKE} install
# Note: coverage options are controlled by .coveragerc file
rm -rf .coverage htmlcov
- $(PYTHON) -m coverage run $(TSCRIPT)
+ PYTHONWARNINGS=all $(PYTHON) -m coverage run $(TSCRIPT)
$(PYTHON) -m coverage report
@echo "writing results to htmlcov/index.html"
$(PYTHON) -m coverage html
@@ -197,7 +197,7 @@ flake8:
@git ls-files | grep \\.py$ | xargs $(PYTHON) -m flake8
check-manifest:
- $(PYTHON) -m check_manifest -v $(ARGS)
+ PYTHONWARNINGS=all $(PYTHON) -m check_manifest -v $(ARGS)
# ===================================================================
# GIT
@@ -220,22 +220,22 @@ install-git-hooks:
# Upload source tarball on https://pypi.python.org/pypi/psutil.
upload-src:
${MAKE} clean
- $(PYTHON) setup.py sdist upload
+ PYTHONWARNINGS=all $(PYTHON) setup.py sdist upload
# Download exes/wheels hosted on appveyor.
win-download-exes:
- $(PYTHON) scripts/internal/download_exes.py --user giampaolo --project psutil
+ PYTHONWARNINGS=all $(PYTHON) scripts/internal/download_exes.py --user giampaolo --project psutil
# Upload exes/wheels in dist/* directory to PYPI.
win-upload-exes:
- $(PYTHON) -m twine upload dist/*.exe
- $(PYTHON) -m twine upload dist/*.whl
+ PYTHONWARNINGS=all $(PYTHON) -m twine upload dist/*.exe
+ PYTHONWARNINGS=all $(PYTHON) -m twine upload dist/*.whl
# All the necessary steps before making a release.
pre-release:
${MAKE} clean
${MAKE} install # to import psutil from download_exes.py
- $(PYTHON) -c \
+ PYTHONWARNINGS=all $(PYTHON) -c \
"from psutil import __version__ as ver; \
doc = open('docs/index.rst').read(); \
history = open('HISTORY.rst').read(); \
@@ -244,18 +244,18 @@ pre-release:
assert 'XXXX' not in history; \
"
${MAKE} win-download-exes
- $(PYTHON) setup.py sdist
+ PYTHONWARNINGS=all $(PYTHON) setup.py sdist
# Create a release: creates tar.gz and exes/wheels, uploads them,
# upload doc, git tag release.
release:
${MAKE} pre-release
- $(PYTHON) -m twine upload dist/* # upload tar.gz, exes, wheels on PYPI
+ PYTHONWARNINGS=all $(PYTHON) -m twine upload dist/* # upload tar.gz, exes, wheels on PYPI
${MAKE} git-tag-release
# Print announce of new release.
print-announce:
- @$(PYTHON) scripts/internal/print_announce.py
+ @PYTHONWARNINGS=all $(PYTHON) scripts/internal/print_announce.py
# ===================================================================
# Misc
@@ -267,12 +267,12 @@ grep-todos:
# run script which benchmarks oneshot() ctx manager (see #799)
bench-oneshot:
${MAKE} install
- $(PYTHON) scripts/internal/bench_oneshot.py
+ PYTHONWARNINGS=all $(PYTHON) scripts/internal/bench_oneshot.py
# same as above but using perf module (supposed to be more precise)
bench-oneshot-2:
${MAKE} install
- $(PYTHON) scripts/internal/bench_oneshot_2.py
+ PYTHONWARNINGS=all $(PYTHON) scripts/internal/bench_oneshot_2.py
# generate a doc.zip file and manually upload it to PYPI.
doc:
@@ -282,4 +282,4 @@ doc:
# check whether the links mentioned in some files are valid.
check-broken-links:
- git ls-files | grep \\.rst$ | xargs $(PYTHON) scripts/internal/check_broken_links.py
+ git ls-files | grep \\.rst$ | xargs PYTHONWARNINGS=all $(PYTHON) scripts/internal/check_broken_links.py