diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-06-14 16:10:51 +0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-06-14 16:10:51 +0800 |
commit | 361681f45f3498ea702edc109c10d190b61067bf (patch) | |
tree | e2647abe030f560e3df048274697d1b5b45caae1 | |
parent | 6e6141de9b822695989fcbd3cb73854ec8165f4c (diff) | |
download | psutil-connections-refactoring.tar.gz |
fix failing testconnections-refactoring
-rw-r--r-- | HISTORY.rst | 6 | ||||
-rw-r--r-- | docs/index.rst | 6 | ||||
-rw-r--r-- | psutil/tests/__init__.py | 10 | ||||
-rwxr-xr-x | psutil/tests/test_connections.py | 5 | ||||
-rwxr-xr-x | psutil/tests/test_contracts.py | 2 |
5 files changed, 17 insertions, 12 deletions
diff --git a/HISTORY.rst b/HISTORY.rst index b9e08da1..044b7bc0 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -5,14 +5,12 @@ XXXX-XX-XX -**Enhancements** - -- 1530_: [NetBSD] add process cwd() support. (patch by Kamil Rytarowski) - **Bug fixes** - 1528_: [AIX] compilation error on AIX 7.2 due to 32 vs 64 bit differences. (patch by Arnon Yaari) +- 1535_: 'type' and 'family' fields returned by net_connections() are not + always turned into enums. 5.6.3 ===== diff --git a/docs/index.rst b/docs/index.rst index 39366009..8c0ee74a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2607,7 +2607,11 @@ take a look at the `development guide`_. Timeline ======== -- 2019-0426: +- 2019-06-11: + `5.6.3 <https://pypi.org/project/psutil/5.6.3/#files>`__ - + `what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#563>`__ - + `diff <https://github.com/giampaolo/psutil/compare/release-5.6.2...release-5.6.3#files_bucket>`__ +- 2019-04-26: `5.6.2 <https://pypi.org/project/psutil/5.6.2/#files>`__ - `what's new <https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#562>`__ - `diff <https://github.com/giampaolo/psutil/compare/release-5.6.1...release-5.6.2#files_bucket>`__ diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index 1fe583b5..5e4f37b3 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -35,6 +35,7 @@ from socket import AF_INET6 from socket import SOCK_STREAM import psutil +from psutil import AIX from psutil import MACOS from psutil import POSIX from psutil import SUNOS @@ -174,6 +175,7 @@ except Exception: HAS_SENSORS_FANS = hasattr(psutil, "sensors_fans") HAS_SENSORS_TEMPERATURES = hasattr(psutil, "sensors_temperatures") HAS_THREADS = hasattr(psutil.Process, "threads") +SKIP_SYSCONS = (MACOS or AIX) and os.getuid() != 0 # --- misc @@ -401,7 +403,7 @@ def create_zombie_proc(): with contextlib.closing(socket.socket(socket.AF_UNIX)) as sock: sock.settimeout(GLOBAL_TIMEOUT) sock.bind(unix_file) - sock.listen() + sock.listen(5) pyrun(src) conn, _ = sock.accept() try: @@ -896,7 +898,7 @@ def bind_socket(family=AF_INET, type=SOCK_STREAM, addr=None): sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind(addr) if type == socket.SOCK_STREAM: - sock.listen() + sock.listen(5) return sock except Exception: sock.close() @@ -911,7 +913,7 @@ def bind_unix_socket(name, type=socket.SOCK_STREAM): try: sock.bind(name) if type == socket.SOCK_STREAM: - sock.listen() + sock.listen(5) except Exception: sock.close() raise @@ -924,7 +926,7 @@ def tcp_socketpair(family, addr=("", 0)): """ with contextlib.closing(socket.socket(family, SOCK_STREAM)) as ll: ll.bind(addr) - ll.listen() + ll.listen(5) addr = ll.getsockname() c = socket.socket(family, SOCK_STREAM) try: diff --git a/psutil/tests/test_connections.py b/psutil/tests/test_connections.py index 12d417e3..5fda78cb 100755 --- a/psutil/tests/test_connections.py +++ b/psutil/tests/test_connections.py @@ -18,7 +18,6 @@ from socket import SOCK_DGRAM from socket import SOCK_STREAM import psutil -from psutil import AIX from psutil import FREEBSD from psutil import LINUX from psutil import MACOS @@ -41,6 +40,7 @@ from psutil.tests import pyrun from psutil.tests import reap_children from psutil.tests import safe_rmpath from psutil.tests import skip_on_access_denied +from psutil.tests import SKIP_SYSCONS from psutil.tests import tcp_socketpair from psutil.tests import TESTFN from psutil.tests import TRAVIS @@ -52,7 +52,6 @@ from psutil.tests import wait_for_file thisproc = psutil.Process() SOCK_SEQPACKET = getattr(socket, "SOCK_SEQPACKET", object()) -SKIP_SYSCONS = (MACOS or AIX) and os.getuid() != 0 class Base(object): @@ -417,7 +416,7 @@ class TestFilters(Base, unittest.TestCase): import socket, time s = socket.socket($family, socket.SOCK_STREAM) s.bind(('$addr', 0)) - s.listen() + s.listen(5) with open('$testfn', 'w') as f: f.write(str(s.getsockname()[:2])) time.sleep(60) diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py index ec86ba40..cb4a2b96 100755 --- a/psutil/tests/test_contracts.py +++ b/psutil/tests/test_contracts.py @@ -36,6 +36,7 @@ from psutil.tests import HAS_SENSORS_FANS from psutil.tests import HAS_SENSORS_TEMPERATURES from psutil.tests import is_namedtuple from psutil.tests import safe_rmpath +from psutil.tests import SKIP_SYSCONS from psutil.tests import TESTFN from psutil.tests import unittest from psutil.tests import VALID_PROC_STATUSES @@ -221,6 +222,7 @@ class TestSystem(unittest.TestCase): self.assertIsInstance(disk.fstype, str) self.assertIsInstance(disk.opts, str) + @unittest.skipIf(SKIP_SYSCONS, "requires root") def test_net_connections(self): with create_sockets(): ret = psutil.net_connections('all') |