aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_socket.py
Commit message (Collapse)AuthorAge
* gh-132987: Support __index__() in the socket module (GH-133093)Serhiy Storchaka3 days
| | | | | | | | ntohl(), htonl(), if_indextoname(), getaddrinfo() now use __index__() if available. Also fix the Argument Clinic names for module-level functions (although this does not affect the user).
* gh-132734: Fix build on FreeBSD and old Linux (GH-132829)Serhiy Storchaka9 days
|
* gh-132734: Add new constants for Bluetooth sockets (GH-132735)Serhiy Storchaka10 days
|
* gh-132099: Accept an integer as the address for BTPROTO_HCI on Linux (GH-132525)Serhiy Storchaka2025-04-16
| | | | | | Previously only an integer packed in a tuple was accepted, while getsockname() could return a raw integer. Now the result of getsockname() is always acceptable as an address.
* gh-70145: Add support for channels in Bluetooth HCI protocol (GH-132481)Serhiy Storchaka2025-04-14
|
* gh-132099: Harmonize Bluetooth address handling (GH-132486)Serhiy Storchaka2025-04-14
| | | | | | | | | | Now all protocols always accept the Bluetooth address as string and getsockname() always returns the Bluetooth address as string. * BTPROTO_SCO now accepts not only bytes, but str. * BTPROTO_SCO now checks address for embedded null. * On *BSD, BTPROTO_HCI now accepts str instead of bytes. * On FreeBSD, getsockname() for BTPROTO_HCI now returns str instead of bytes. * On NetBSD and DragonFly BDS, BTPROTO_HCI now checks address for embedded null.
* gh-132429: Remove not working test for Bluetooth socket (GH-132459)Serhiy Storchaka2025-04-12
|
* gh-132429: Fix support of Bluetooth sockets on NetBSD and DragonFly BSD ↵Serhiy Storchaka2025-04-12
| | | | | | | (GH-132431) * Also add support for cid and bdaddr_type in the BTPROTO_L2CAP address on FreeBSD. * Return cid in getsockname() for BTPROTO_L2CAP if it is not zero. * Fix a compiler warning on FreeBSD.
* gh-85302: Add support for BTPROTO_SCO on FreeBSD (GH-131981)Serhiy Storchaka2025-04-11
| | | | BTPROTO_SCO has been supported on FreeBSD since 2008.
* Skip a test for Bluetooth HCI socket (added in GH-132023) if it fails ↵Serhiy Storchaka2025-04-05
| | | | (GH-132072)
* Add tests for Bluetooth RFCOMM, HCI and SCO (GH-132023)Serhiy Storchaka2025-04-04
|
* gh-128770: raise warnings as errors in test suite - except for test_socket ↵Thomas Grainger2025-03-27
| | | | | which still logs warnings, and internal test warnings that are now logged (#128973) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-114917: add support for AI_NUMERICSERV in getaddrinfo emulation (#114918)Max Bachmann2025-03-18
|
* gh-129288: Add optional l2_cid and l2_bdaddr_type in BTPROTO_L2CAP socket ↵Fredrik Ahlberg2025-02-27
| | | | | | | | | | address tuple (#129293) Add two optional, traling elements in the AF_BLUETOOTH socket address tuple: - l2_cid, to allow e.g raw LE ATT connections - l2_bdaddr_type. To be able to connect L2CAP sockets to Bluetooth LE devices, the l2_bdaddr_type must be set to BDADDR_LE_PUBLIC or BDADDR_LE_RANDOM.
* gh-119461: Restore the testSocket VSOCK skipUnless removed by PR #119465 ↵Gregory P. Smith2025-02-01
| | | | | | | | | | | | | | | | | (#129561) Restore the skipUnless removed by #119465. This test can only pass on virtual machines, not actual machines. actual machines see: ``` self.cli.connect((cid, VSOCKPORT)) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ OSError: [Errno 19] No such device ``` Reproduced on (Linux) Ubuntu 24.04.1 running 6.8.0-52-generic.
* Revert "gh-128770: raise warnings as errors in test suite - except for ↵Hugo van Kemenade2025-01-17
| | | | test_socket which still logs warnings (#128726)" (#128936)
* gh-128770: raise warnings as errors in test suite - except for test_socket ↵Thomas Grainger2025-01-17
| | | | | | | which still logs warnings (#128726) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Brett Cannon <brett@python.org>
* gh-128277: remove unnecessary critical section from `socket.close` (#128305)Kumar Aditya2025-01-01
| | | Remove unnecessary critical section from `socket.close` as it now uses relaxed atomics for `sock_fd`.
* gh-128116: Skip test_socket VSOCK testStream() on PermissionError (#128120)Victor Stinner2024-12-20
|
* gh-126876: Fix test_socket.testLargeTimeout() for missing _testcapi (#127517)Victor Stinner2024-12-02
|
* gh-126876: Fix socket internal_select() for large timeout (#126968)Victor Stinner2024-11-19
| | | | | | If the timeout is larger than INT_MAX, replace it with INT_MAX, in the poll() code path. Add an unit test.
* Skip test in test_socket.py if `sys.getrefcount` isn't available (#126640)CF Bolz-Tereick2024-11-10
| | | Skip `testMakefileCloseSocketDestroy` test if `sys.getrefcount` isn't available. This is necessary for PyPy and other Python implementations that do not have `sys.getrefcount`.
* Android: Update tests for newly-available functions affected by SELinux ↵Malcolm Smith2024-10-27
| | | | | (#126015) Skip tests on Android that involve use of SELinux-protected methods.
* Fix typos (#123775)algonell2024-09-09
|
* gh-117657: Fix file descriptor race in test_socket.py (#123697)Nadeshiko Manju2024-09-06
|
* gh-123476: Add support for TCP_QUICKACK socket setting to Windows (#123478)nkinnan2024-09-05
| | | | | Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Steve Dower <steve.dower@microsoft.com>
* gh-122133: Rework pure Python socketpair tests to avoid use of ↵Russell Keith-Magee2024-07-31
| | | | | | importlib.reload. (#122493) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-122133: Authenticate socket connection for `socket.socketpair()` fallback ↵Seth Michael Larson2024-07-29
| | | | | | | (GH-122134) * Authenticate socket connection for `socket.socketpair()` fallback when the platform does not have a native `socketpair` C API. We authenticate in-process using `getsocketname` and `getpeername` (thanks to Nathaniel J Smith for that suggestion). Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-119461: Fix ThreadedVSOCKSocketStreamTest (#119465)Victor Stinner2024-05-23
| | | | | | | | | | Add socket.VMADDR_CID_LOCAL constant. Fix ThreadedVSOCKSocketStreamTest: if get_cid() returns the host address or the "any" address, use the local communication address (loopback): VMADDR_CID_LOCAL. On Linux 6.9, apparently, the /dev/vsock device is now available but get_cid() returns VMADDR_CID_ANY (-1).
* gh-116303: Skip test module dependent tests if test modules are unavailable ↵Erlend E. Aasland2024-04-03
| | | | (#117341)
* gh-71042: Add `platform.android_ver` (#116674)Malcolm Smith2024-03-27
|
* gh-71052: Change Android's `sys.platform` from "linux" to "android"Malcolm Smith2024-03-11
| | | | Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-101384: Add socket timeout to ThreadedVSOCKSocketStreamTest and skip it ↵Peter Jiping Xie2024-02-17
| | | | on WSL (GH-101419)
* gh-114099: Add test exclusions to support running the test suite on iOS ↵Russell Keith-Magee2024-02-05
| | | | | | | | | | | | | (#114889) Add test annotations required to run the test suite on iOS (PEP 730). The majority of the change involve annotating tests that use subprocess, but are skipped on Emscripten/WASI for other reasons, and including iOS/tvOS/watchOS under the same umbrella as macOS/darwin checks. `is_apple` and `is_apple_mobile` test helpers have been added to identify *any* Apple platform, and "any Apple platform except macOS", respectively.
* gh-80931: Skip some socket tests while hunting for refleaks on macOS (#114057)Ronald Oussoren2024-01-21
| | | | | Some socket tests related to sending file descriptors cause a file descriptor leak on macOS, all of them tests that send one or more descriptors than cannot be received on the read end. This appears to be a platform bug. This PR skips those tests when doing a refleak test run to avoid hiding other problems.
* bpo-37013: Fix the error handling in socket.if_indextoname() (GH-13503)Zackery Spytz2023-12-01
| | | | | * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms.
* gh-76106: Remove the cleanup lock in test_socket (GH-110539)Serhiy Storchaka2023-10-11
| | | | | It does not already work (because it locks only addCleanup(), not doCleanups()), and it is no longer needed since the clean up procedure waits for all test threads to join.
* gh-110167: Fix test_socket deadlock in doCleanups() (#110416)Victor Stinner2023-10-05
| | | | | | | | | | | | | Fix a deadlock in test_socket when server fails with a timeout but the client is still running in its thread. Don't hold a lock to call cleanup functions in doCleanups(). One of the cleanup function waits until the client completes, whereas the client could deadlock if it called addCleanup() in such situation. doCleanups() is called when the server completed, but the client can still be running in its thread especially if the server failed with a timeout. Don't put a lock on doCleanups() to prevent deadlock between addCleanup() called in the client and doCleanups() waiting for self.done.wait of ThreadableTest._setUp().
* gh-110391: socket NetworkConnectionAttributesTest always declare cli (#110401)Victor Stinner2023-10-05
| | | | NetworkConnectionAttributesTest of test_socket now always declare the 'cli' attribute, so clientTearDown() cannot fail with AttributeError.
* gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (#109423)Victor Stinner2023-09-14
| | | | Use a longer key: FIPS mode requires at least of at least 112 bits. The previous key was only 32 bits.
* gh-109015: Add test.support.socket_helper.tcp_blackhole() (#109016)Victor Stinner2023-09-07
| | | | Skip test_asyncio, test_imaplib and test_socket tests if FreeBSD TCP blackhole is enabled (net.inet.tcp.blackhole=2).
* gh-92658: Fix typo in docs and tests for `HV_GUID_PARENT` (GH-105267)Nikita Sobolev2023-06-06
|
* gh-74895: adjust tests to work on Solaris (#104326)Jakub Kulík2023-05-09
| | | Solaris is unusual here, but apparently everyone is happy when SOCK_STREAM is explicitly specified.
* gh-103092: Isolate `socket` module (#103094)Erlend E. Aasland2023-04-09
|
* gh-102943: Stop checking localized error text in socket tests on Windows ↵AN Long2023-03-23
| | | | (GH-102944)
* gh-102799: remove unnecessary calls to sys.exc_info() in tests (#102800)Irit Katriel2023-03-18
|
* gh-74895: getaddrinfo no longer raises OverflowError (#2435)Radek Smejkal2023-02-13
| | | `socket.getaddrinfo()` no longer raises `OverflowError` based on the **port** argument. Error reporting (or not) for its value is left up to the underlying C library `getaddrinfo()` implementation.
* gh-100374: Fixed a bug in socket.getfqdn() (gh-100375)Dominic Socular2022-12-21
|
* gh-95243: Mitigate the race condition in testSockName (#96173)Ross Burton2022-08-24
| | | | | | | | find_unused_port() has an inherent race condition, but we can't use bind_port() as that uses .getsockname() which this test is exercising. Try binding to unused ports a few times before failing. Signed-off-by: Ross Burton <ross.burton@arm.com>
* gh-95174: WASI: skip missing sockets functions (GH-95179)Christian Heimes2022-07-27
|