summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-05-01 13:37:37 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2020-05-01 13:37:37 +0200
commit6f4e38220d9da33931ff9a307d20025a6916c258 (patch)
treef625ae05775d3cd872670152c871e08eb6ef0c13 /scripts
parent8d8a7804d159e5b80378000b57bbfbaf63ce6e8f (diff)
downloadpsutil-6f4e38220d9da33931ff9a307d20025a6916c258.tar.gz
Drastically improve "make test/build" speed.
Doing "make install" before any test is slow and not really necessary. Instead do "make build", and remove the part import setuptools and test psutil can be imported (do that in make install instead). This way I went down from 0.8 secs (install phase before starting the test) to 0.3 secs!
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/internal/purge_installation.py2
-rwxr-xr-xscripts/internal/winmake.py28
2 files changed, 15 insertions, 15 deletions
diff --git a/scripts/internal/purge_installation.py b/scripts/internal/purge_installation.py
index 50c00463..8a9597f0 100755
--- a/scripts/internal/purge_installation.py
+++ b/scripts/internal/purge_installation.py
@@ -30,7 +30,7 @@ def rmpath(path):
def main():
locations = [site.getusersitepackages()]
- locations.extend(site.getsitepackages())
+ locations += site.getsitepackages()
for root in locations:
if os.path.isdir(root):
for name in os.listdir(root):
diff --git a/scripts/internal/winmake.py b/scripts/internal/winmake.py
index eebd1692..c7091ac4 100755
--- a/scripts/internal/winmake.py
+++ b/scripts/internal/winmake.py
@@ -399,7 +399,7 @@ def lint():
def test(name=""):
"""Run tests"""
- install()
+ build()
test_setup()
sh("%s %s %s" % (PYTHON, RUNNER_PY, name))
@@ -407,7 +407,7 @@ def test(name=""):
def coverage():
"""Run coverage tests."""
# Note: coverage options are controlled by .coveragerc file
- install()
+ build()
test_setup()
sh("%s -m coverage run %s" % (PYTHON, RUNNER_PY))
sh("%s -m coverage report" % PYTHON)
@@ -417,70 +417,70 @@ def coverage():
def test_process():
"""Run process tests"""
- install()
+ build()
test_setup()
sh("%s psutil\\tests\\test_process.py" % PYTHON)
def test_system():
"""Run system tests"""
- install()
+ build()
test_setup()
sh("%s psutil\\tests\\test_system.py" % PYTHON)
def test_platform():
"""Run windows only tests"""
- install()
+ build()
test_setup()
sh("%s psutil\\tests\\test_windows.py" % PYTHON)
def test_misc():
"""Run misc tests"""
- install()
+ build()
test_setup()
sh("%s psutil\\tests\\test_misc.py" % PYTHON)
def test_unicode():
"""Run unicode tests"""
- install()
+ build()
test_setup()
sh("%s psutil\\tests\\test_unicode.py" % PYTHON)
def test_connections():
"""Run connections tests"""
- install()
+ build()
test_setup()
sh("%s psutil\\tests\\test_connections.py" % PYTHON)
def test_contracts():
"""Run contracts tests"""
- install()
+ build()
test_setup()
sh("%s psutil\\tests\\test_contracts.py" % PYTHON)
def test_by_name(name):
"""Run test by name"""
- install()
+ build()
test_setup()
sh("%s -m unittest -v %s" % (PYTHON, name))
def test_failed():
"""Re-run tests which failed on last run."""
- install()
+ build()
test_setup()
sh("%s %s --last-failed" % (PYTHON, RUNNER_PY))
def test_memleaks():
"""Run memory leaks tests"""
- install()
+ build()
test_setup()
sh("%s psutil\\tests\\test_memory_leaks.py" % PYTHON)
@@ -509,14 +509,14 @@ def bench_oneshot_2():
def print_access_denied():
"""Print AD exceptions raised by all Process methods."""
- install()
+ build()
test_setup()
sh("%s -Wa scripts\\internal\\print_access_denied.py" % PYTHON)
def print_api_speed():
"""Benchmark all API calls."""
- install()
+ build()
test_setup()
sh("%s -Wa scripts\\internal\\print_api_speed.py" % PYTHON)