diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-02-10 22:48:45 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-02-10 22:48:45 +0100 |
commit | 541bd380b6bd627571c48f3b95d3ae66adccada4 (patch) | |
tree | 07a61bcd92a657b2a3158d4dc7b3d62c353b5e66 | |
parent | c06ff6fdc5a162bb92bf86d83613415e707b6ab8 (diff) | |
parent | 069a8815ce6f69a37130aa3cb7fd3acf6a791441 (diff) | |
download | psutil-541bd380b6bd627571c48f3b95d3ae66adccada4.tar.gz |
Merge branch 'master' of github.com:giampaolo/psutil
-rw-r--r-- | HISTORY.rst | 1 | ||||
-rw-r--r-- | make.bat | 29 | ||||
-rw-r--r-- | psutil/_psutil_bsd.c | 5 | ||||
-rw-r--r-- | psutil/tests/test_process.py | 22 |
4 files changed, 52 insertions, 5 deletions
diff --git a/HISTORY.rst b/HISTORY.rst index 5be3772f..30fd1eec 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -30,6 +30,7 @@ Bug tracker at https://github.com/giampaolo/psutil/issues - #754: [Linux] cmdline() can be wrong in case of zombie process. - #759: [Linux] Process.memory_maps() may return paths ending with " (deleted)" - #761: [Windows] psutil.boot_time() wraps to 0 after 49 days. +- #764: [NetBSD] fix compilation on NetBSD-6.x. 3.4.2 - 2016-01-20 @@ -125,6 +125,12 @@ if "%1" == "test-system" ( goto :eof ) +if "%1" == "test-by-name" ( + call :install + %PYTHON% -m nose psutil\tests\test_process.py psutil\tests\test_system.py psutil\tests\test_windows.py psutil\tests\test_misc.py --nocapture -v -m %2 + goto :eof +) + if "%1" == "test-memleaks" ( call :install %PYTHON% test\test_memory_leaks.py @@ -171,6 +177,26 @@ if "%1" == "setup-dev-env" ( @echo downloading pip installer @echo ------------------------------------------------ C:\python27\python.exe -c "import urllib2; r = urllib2.urlopen('https://raw.github.com/pypa/pip/master/contrib/get-pip.py'); open('get-pip.py', 'wb').write(r.read())" + @echo ------------------------------------------------ + @echo installing pip + @echo ------------------------------------------------ + %PYTHON% get-pip.py + @echo ------------------------------------------------ + @echo installing deps + @echo ------------------------------------------------ + rem mandatory / for unittests + %PYTHON% -m pip install unittest2 ipaddress mock wmi wheel pypiwin32 --upgrade + rem nice to have + %PYTHON% -m pip install ipdb nose --upgrade + goto :eof +) + +if "%1" == "setup-dev-env-all" ( + :setup-env + @echo ------------------------------------------------ + @echo downloading pip installer + @echo ------------------------------------------------ + C:\python27\python.exe -c "import urllib2; r = urllib2.urlopen('https://raw.github.com/pypa/pip/master/contrib/get-pip.py'); open('get-pip.py', 'wb').write(r.read())" for %%P in (%ALL_PYTHONS%) do ( @echo ------------------------------------------------ @echo installing pip for %%P @@ -184,11 +210,12 @@ if "%1" == "setup-dev-env" ( rem mandatory / for unittests %%P -m pip install unittest2 ipaddress mock wmi wheel pypiwin32 --upgrade rem nice to have - %%P -m pip install ipdb pep8 pyflakes flake8 --upgrade + %%P -m pip install ipdb nose --upgrade ) goto :eof ) + if "%1" == "flake8" ( :flake8 %PYTHON% -c "from flake8.main import main; main()" diff --git a/psutil/_psutil_bsd.c b/psutil/_psutil_bsd.c index fbd4f0ef..fa596d34 100644 --- a/psutil/_psutil_bsd.c +++ b/psutil/_psutil_bsd.c @@ -96,6 +96,9 @@ #include <utmpx.h> #include <sys/vnode.h> // for VREG #include <sys/sched.h> // for CPUSTATES & CP_* + #ifndef DTYPE_VNODE + #define DTYPE_VNODE 1 + #endif #endif @@ -706,8 +709,10 @@ psutil_disk_partitions(PyObject *self, PyObject *args) { strlcat(opts, ",relatime", sizeof(opts)); if (flags & MNT_IGNORE) strlcat(opts, ",ignore", sizeof(opts)); +#if defined(MNT_DISCARD) if (flags & MNT_DISCARD) strlcat(opts, ",discard", sizeof(opts)); +#endif if (flags & MNT_EXTATTR) strlcat(opts, ",extattr", sizeof(opts)); if (flags & MNT_LOG) diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py index a0c88911..83f5b549 100644 --- a/psutil/tests/test_process.py +++ b/psutil/tests/test_process.py @@ -1888,10 +1888,15 @@ class TestUnicode(unittest.TestCase): env['FUNNY_ARG'] = self.uexe sproc = get_test_subprocess(env=env) p = psutil.Process(sproc.pid) - self.assertEqual(p.environ()['FUNNY_ARG'], self.uexe) + if PY3: + self.assertEqual(p.environ()['FUNNY_ARG'], self.uexe) + else: + self.assertEqual(p.environ()['FUNNY_ARG'], + self.uexe.decode(sys.getfilesystemencoding())) def test_disk_usage(self): - psutil.disk_usage(self.uexe) + path = tempfile.mkdtemp(prefix='psutil', suffix='รจ') + psutil.disk_usage(path) class TestNonUnicode(unittest.TestCase): @@ -1995,17 +2000,26 @@ class TestNonUnicode(unittest.TestCase): def test_proc_environ(self): env = os.environ.copy() - env['FUNNY_ARG'] = self.temp_directory + funny_path = self.temp_directory + # ...otherwise subprocess.Popen fails with TypeError (it + # wants a string) + env['FUNNY_ARG'] = \ + decode_path(funny_path) if WINDOWS and PY3 else funny_path sproc = get_test_subprocess(env=env) p = psutil.Process(sproc.pid) self.assertEqual( - encode_path(p.environ()['FUNNY_ARG']), self.temp_directory) + encode_path(p.environ()['FUNNY_ARG']), funny_path) def test_disk_usage(self): funny_directory = os.path.realpath( os.path.join(self.temp_directory, b"\xc0\x80")) os.mkdir(funny_directory) self.addCleanup(safe_rmdir, funny_directory) + if WINDOWS and PY3: + # Python 3 on Windows is moving towards accepting unicode + # paths only: + # http://bugs.python.org/issue26330 + funny_directory = decode_path(funny_directory) psutil.disk_usage(funny_directory) |