summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-02-08 02:33:00 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2016-02-08 02:33:00 +0100
commitccf632139b567d42244821cc39712e67a8f66e2b (patch)
tree33fe057aa2207d33c1fafa90c6b4963a4a94f000
parentcc16e96f18c9cce8258db9d40a16426e7268f7f9 (diff)
downloadpsutil-ccf632139b567d42244821cc39712e67a8f66e2b.tar.gz
fix broken tests
-rwxr-xr-x.ci/travis/run.sh4
-rw-r--r--DEVGUIDE.rst9
-rw-r--r--Makefile6
-rw-r--r--appveyor.yml2
-rw-r--r--make.bat4
-rw-r--r--psutil/tests/test_memory_leaks.py16
6 files changed, 14 insertions, 27 deletions
diff --git a/.ci/travis/run.sh b/.ci/travis/run.sh
index 41167aa8..ce21e8ac 100755
--- a/.ci/travis/run.sh
+++ b/.ci/travis/run.sh
@@ -12,7 +12,7 @@ fi
python setup.py build
python setup.py install
-coverage run test/test_psutil.py --include="psutil/*" --omit="test/*,*setup*"
-python test/test_memory_leaks.py
+coverage run psutil/tests/runner.py --include="psutil/*" --omit="test/*,*setup*"
+python psutil/tests/test_memory_leaks.py
flake8
pep8
diff --git a/DEVGUIDE.rst b/DEVGUIDE.rst
index cfbc1789..996a679b 100644
--- a/DEVGUIDE.rst
+++ b/DEVGUIDE.rst
@@ -49,8 +49,8 @@ Usually the files involved when adding a new functionality are:
psutil/_ps{platform}.py # python platform wrapper
psutil/_psutil_{platform}.c # C platform extension
psutil/_psutil_{platform}.h # C header file
- test/test_psutil.py # main test suite
- test/_{platform}.py # platform specific test suite
+ test/test_process|system.py # main test suite
+ test/test_{platform}.py # platform specific test suite
Typical process occurring when adding a new functionality (API):
@@ -59,9 +59,8 @@ Typical process occurring when adding a new functionality (API):
(e.g. ``psutil/_pslinux.py``).
- if the change requires C code write the C implementation in
``psutil/_psutil_{platform}.c`` (e.g. ``psutil/_psutil_linux.c``).
-- write a cross platform test in ``test/test_psutil.py``.
-- write a platform specific test in ``test/_{platform}.py``; platform specific
- tests usually test psutil against system CLI tools.
+- write a cross platform test in ``psutil/tests/test_{platform}.py``
+ (e.g. ``test_linux.py``).
- update doc.
- make a pull request.
diff --git a/Makefile b/Makefile
index da66d765..a6066a0d 100644
--- a/Makefile
+++ b/Makefile
@@ -66,13 +66,13 @@ test: install
$(PYTHON) $(TSCRIPT)
test-process: install
- $(PYTHON) -m unittest -v test.test_psutil.TestProcess
+ $(PYTHON) -m unittest -v psutil.tests.test_process
test-system: install
- $(PYTHON) -m unittest -v test.test_psutil.TestSystemAPIs
+ $(PYTHON) -m unittest -v psutil.tests.test_system
test-memleaks: install
- $(PYTHON) test/test_memory_leaks.py
+ $(PYTHON) psutil/tests/test_memory_leaks.py
# Run a specific test by name; e.g. "make test-by-name disk_" will run
# all test methods containing "disk_" in their name.
diff --git a/appveyor.yml b/appveyor.yml
index dfbd5d9d..643d0c66 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -73,7 +73,7 @@ install:
build: off
test_script:
- - "%WITH_COMPILER% %PYTHON%/python test/test_psutil.py"
+ - "%WITH_COMPILER% %PYTHON%/python psutil/tests/runner.py"
after_test:
- "%WITH_COMPILER% %PYTHON%/python setup.py bdist_wheel"
diff --git a/make.bat b/make.bat
index 724eba40..d456f0ce 100644
--- a/make.bat
+++ b/make.bat
@@ -115,13 +115,13 @@ if "%1" == "test" (
if "%1" == "test-process" (
call :install
- %PYTHON% -m unittest -v test.test_psutil.TestProcess
+ %PYTHON% -m unittest -v psutil.tests.test_process
goto :eof
)
if "%1" == "test-system" (
call :install
- %PYTHON% -m unittest -v test.test_psutil.TestSystem
+ %PYTHON% -m unittest -v psutil.tests.test_system
goto :eof
)
diff --git a/psutil/tests/test_memory_leaks.py b/psutil/tests/test_memory_leaks.py
index dce70eab..9f7725fe 100644
--- a/psutil/tests/test_memory_leaks.py
+++ b/psutil/tests/test_memory_leaks.py
@@ -14,7 +14,6 @@ import functools
import gc
import os
import socket
-import sys
import threading
import time
@@ -35,11 +34,11 @@ from psutil.tests import get_test_subprocess
from psutil.tests import reap_children
from psutil.tests import RLIMIT_SUPPORT
from psutil.tests import safe_remove
+from psutil.tests import test_module_by_name
from psutil.tests import TESTFN
from psutil.tests import TRAVIS
from psutil.tests import unittest
-
LOOPS = 1000
MEMORY_TOLERANCE = 4096
SKIP_PYTHON_IMPL = True
@@ -444,16 +443,5 @@ class TestModuleFunctionsLeaks(Base):
self.execute('net_if_stats')
-def main():
- test_suite = unittest.TestSuite()
- tests = [TestProcessObjectLeaksZombie,
- TestProcessObjectLeaks,
- TestModuleFunctionsLeaks]
- for test in tests:
- test_suite.addTest(unittest.makeSuite(test))
- result = unittest.TextTestRunner(verbosity=2).run(test_suite)
- return result.wasSuccessful()
-
if __name__ == '__main__':
- if not main():
- sys.exit(1)
+ test_module_by_name(__file__)