summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-104690 Disallow thread creation and fork at interpreter ↵Miss Islington (bot)2023-06-041-0/+16
| | | | | | | | | | | | | | | | | | | | | finalization (GH-104826) (#105277) gh-104690 Disallow thread creation and fork at interpreter finalization (GH-104826) Disallow thread creation and fork at interpreter finalization. in the following functions, check if interpreter is finalizing and raise `RuntimeError` with appropriate message: * `_thread.start_new_thread` and thus `threading` * `posix.fork` * `posix.fork1` * `posix.forkpty` * `_posixsubprocess.fork_exec` when a `preexec_fn=` is supplied. --------- (cherry picked from commit ce558e69d4087dd3653207de78345fbb8a2c7835) Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-75729: Fix os.spawn tests not handling spaces on Windows (#99150)C.A.M. Gerlach2023-04-081-45/+57
| | | | | | | | | | | | | * Quote paths in os.spawn tests on Windows so they work with spaces * Add NEWS entry for os spawn test fix * Fix code style to avoid double negative in os.spawn tests Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> --------- Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-99726: Improves correctness of stat results for Windows, and uses faster ↵Steve Dower2023-03-161-1/+11
| | | | | API when available (GH-102149) This deprecates `st_ctime` fields on Windows, with the intent to change them to contain the correct value in 3.14. For now, they should keep returning the creation time as they always have.
* gh-102519: Avoid failing tests due to inaccessible volumes (GH-102706)Steve Dower2023-03-151-6/+11
|
* gh-102519: Add os.listdrives, os.listvolumes and os.listmounts on Windows ↵Steve Dower2023-03-101-0/+43
| | | | (GH-102544)
* gh-102255: Improve build support for Windows API partitions (GH-102256)Max Bachmann2023-03-091-3/+5
| | | | | Add `MS_WINDOWS_DESKTOP`, `MS_WINDOWS_APPS`, `MS_WINDOWS_SYSTEM` and `MS_WINDOWS_GAMES` preprocessor definitions to allow switching off functionality missing from particular API partitions ("partitions" are used in Windows to identify overlapping subsets of APIs). CPython only officially supports `MS_WINDOWS_DESKTOP` and `MS_WINDOWS_SYSTEM` (APPS is included by normal desktop builds, but APPS without DESKTOP is not covered). Other configurations are a convenience for people building their own runtimes. `MS_WINDOWS_GAMES` is for the Xbox subset of the Windows API, which is also available on client OS, but is restricted compared to `MS_WINDOWS_DESKTOP`. These restrictions may change over time, as they relate to the build headers rather than the OS support, and so we assume that Xbox builds will use the latest available version of the GDK.
* gh-102179: Fix `os.dup2` error reporting for negative fds (#102180)Alexey Izbyshev2023-03-041-0/+20
|
* gh-101881: Support (non-)blocking read/write functions on Windows pipes ↵Rayyan Ansari2023-02-161-0/+1
| | | | | | | | | | | | (GH-101882) * fileutils: handle non-blocking pipe IO on Windows Handle erroring operations on non-blocking pipes by reading the _doserrno code. Limit writes on non-blocking pipes that are too large. * Support blocking functions on Windows Use the GetNamedPipeHandleState and SetNamedPipeHandleState Win32 API functions to add support for os.get_blocking and os.set_blocking.
* gh-101196: Make isdir/isfile/exists faster on Windows (GH-101324)Michael Droettboom2023-02-081-0/+2
| | | Co-authored-by: Eryk Sun <eryksun@gmail.com>
* gh-100228: Warn from os.fork() if other threads exist. (#100229)Gregory P. Smith2022-12-291-0/+28
| | | | | Not comprehensive, best effort warning. There are cases when threads exist on some platforms that this code cannot detect. macOS when API permissions allow and Linux with a readable /proc procfs present are the currently supported cases where a warning should show up reliably. Starting with a DeprecationWarning for now, it is less disruptive than something like RuntimeWarning and most likely to only be seen in people's CI tests - a good place to start with this messaging.
* gh-89727: Fix os.walk RecursionError on deep trees (#99803)Jon Burdo2022-12-191-0/+43
| | | | | Use a stack to implement os.walk iteratively instead of recursively to avoid hitting recursion limits on deeply nested trees.
* gh-81057: Move OS-Related Globals to _PyRuntimeState (gh-100082)Eric Snow2022-12-081-6/+7
| | | https://github.com/python/cpython/issues/81057
* gh-99547: Add isjunction methods for checking if a path is a junction (GH-99548)Charles Machalow2022-11-221-0/+17
|
* gh-98393: Update test_os for bytes-like types (#98487)Victor Stinner2022-11-021-34/+12
| | | Address Serhiy Storchaka's review.
* gh-98393: os module reject bytes-like, only accept bytes (#98394)Victor Stinner2022-10-181-20/+12
| | | | | The os module and the PyUnicode_FSDecoder() function no longer accept bytes-like paths, like bytearray and memoryview types: only the exact bytes type is accepted for bytes strings.
* gh-43414: os.get_terminal_size() now uses the actual file descriptor on ↵Raghunandan Bhat2022-07-281-0/+13
| | | | Windows instead of mapping to standard handles (#93203)
* gh-90473: Fix more tests on platforms without umask (GH-95164)Christian Heimes2022-07-231-0/+8
|
* gh-90473: Make chmod a dummy on WASI, skip chmod tests (GH-93534)Christian Heimes2022-06-061-2/+3
| | | WASI does not have the ``chmod(2)`` syscall yet.
* gh-90473: WASI requires proper open(2) flags (GH-93529)Christian Heimes2022-06-061-1/+2
|
* gh-90473: Skip and document more failing tests on WASI (GH-93436)Christian Heimes2022-06-021-1/+7
| | | | | | | - Mark more ``umask()`` cases - ``dup()`` is not supported - ``/dev/null`` is not available - document missing features - mark more modules as not available
* gh-90473: Misc test fixes for WASI (GH-93218)Christian Heimes2022-05-251-0/+2
| | | | | | | | * ``sys.executable`` is not set * WASI does not support subprocess * ``pwd`` module is not available * WASI checks ``open`` syscall flags more strict, needs r, w, rw flag. * ``umask`` is not available * ``/dev/null`` may not be accessible
* gh-90473: Decrease recursion limit and skip tests on WASI (GH-92803)Christian Heimes2022-05-191-2/+7
|
* bpo-46785: Fix race condition between os.stat() and unlink on Windows (GH-31858)Itai Steinherz2022-05-021-0/+44
|
* bpo-40280: Enable most file-at() and nanosleep APIs again (GH-32238)Christian Heimes2022-04-021-1/+9
|
* bpo-47015: Update test_os from asyncore to asyncio (GH-31876)Oleg Iarygin2022-03-201-157/+79
|
* bpo-40280: Skip more tests on Emscripten (GH-31947)Christian Heimes2022-03-171-1/+9
| | | | | | - lchmod, lchown are not fully implemented - skip umask tests - cannot fstat unlinked or renamed files yet - ignore musl libc issues that affect Emscripten
* bpo-40280: Skip more tests/features that don't apply to Emscripten (GH-31791)Christian Heimes2022-03-101-0/+3
| | | | | | | - fd inheritance can't be modified because Emscripten doesn't support subprocesses anyway. - setpriority always fails - geteuid no longer causes problems with latest emsdk - umask is a stub - geteuid / getuid always return 0, but process cannot chown to random uid.
* bpo-40280: Block more non-working syscalls in Emscripten (GH-31757)Christian Heimes2022-03-081-0/+1
| | | | | | | | | - getgroups always fails. - geteuid and getegid always return 0 (root), which confuse tarfile and tests. - hardlinks (link, linkat) always fails. - non-encodable file names are not supported by NODERAWFS layer. - mark more tests with dependency on subprocess and multiprocessing. Mocking does not work if the module fails to import.
* bpo-40280: Address more test failures on Emscripten (GH-31050)Christian Heimes2022-02-051-0/+4
| | | Co-authored-by: Brett Cannon <brett@python.org>
* bpo-40280: Skip subprocess-based tests on wasm32-emscripten (GH-30615)Christian Heimes2022-01-251-0/+8
|
* bpo-46426: Improve tests for the dir_fd argument (GH-30668)Serhiy Storchaka2022-01-211-8/+2
| | | | | | | Ensure that directory file descriptors refer to directories different from the current directory, and that src_dir_fd and dst_dir_fd refer to different directories. Add context manager open_dir_fd() in test.support.os_helper.
* Revert "bpo-28533: Remove asyncore, asynchat, smtpd modules (GH-29521)" ↵Victor Stinner2021-12-071-2/+5
| | | | | (GH-29951) This reverts commit 9bf2cbc4c498812e14f20d86acb61c53928a5a57.
* bpo-42540: reallocation of id_mutex should not force default allocator ↵Sam Gross2021-11-171-0/+16
| | | | | | | (GH-29564) Unlike the other locks reinitialized by _PyRuntimeState_ReInitThreads, the "interpreters.main->id_mutex" is not freed by _PyRuntimeState_Fini and should not force the default raw allocator.
* bpo-28533: Remove asyncore, asynchat, smtpd modules (GH-29521)Victor Stinner2021-11-151-5/+2
| | | | | | | | | | | | | | | | Remove the asyncore and asynchat modules, deprecated in Python 3.6: use the asyncio module instead. Remove the smtpd module, deprecated in Python 3.6: the aiosmtpd module can be used instead, it is based on asyncio. * Remove asyncore, asynchat and smtpd documentation * Remove test_asyncore, test_asynchat and test_smtpd * Rename Lib/asynchat.py to Lib/test/support/_asynchat.py * Rename Lib/asyncore.py to Lib/test/support/_asyncore.py * Rename Lib/smtpd.py to Lib/test/support/_smtpd.py * Remove DeprecationWarning from private _asyncore, _asynchat and _smtpd modules * _smtpd: remove deprecated properties
* bpo-44631: Make the repr() of the _Environ class more readable. (#27128)Leonardo Freua2021-07-201-3/+5
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44498: suppress DeprecationWarnings for asynchat, asyncore and smtpd in ↵Irit Katriel2021-06-241-2/+5
| | | | tests (GH-26905)
* bpo-43651: Fix EncodingWarning in `os.fdopen()` and test_os (GH-25654)Inada Naoki2021-04-291-9/+12
|
* bpo-42780: Fix set_inheritable() for O_PATH file descriptors on Linux (GH-24172)cptpcrd2021-01-201-0/+27
|
* bpo-31904: Disable os.popen and popen test cases on VxWorks (GH-21687)pxinwr2020-12-151-0/+2
|
* bpo-31904: Fix test_os.test_getcwd_long_path() failure for VxWorks (GH-20256)pxinwr2020-11-281-0/+4
|
* bpo-41625: Skip os.splice() tests on AIX (GH-23354)Victor Stinner2020-11-171-0/+8
| | | | On AIX, splice() only works with a socket, whereas the test uses a pipe.
* bpo-41625: Expose the splice() system call in the os module (GH-21947)Pablo Galindo2020-11-171-0/+117
|
* bpo-41001: Add os.eventfd() (#20930)Christian Heimes2020-11-131-0/+86
| | | Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* bpo-40275: Remove test helpers aliases in test.support (GH-21771)Hai Shi2020-08-081-2/+3
|
* bpo-40275: Use new test.support helper submodules in tests (GH-21169)Hai Shi2020-06-301-171/+174
|
* bpo-41069: Make TESTFN and the CWD for tests containing non-ascii ↵Serhiy Storchaka2020-06-251-3/+3
| | | | characters. (GH-21035)
* bpo-40275: Adding threading_helper submodule in test.support (GH-20263)Hai Shi2020-05-271-2/+3
|
* bpo-40165: Suppress stderr when checking if test_stty_match should be ↵Batuhan Taskaya2020-05-161-1/+5
| | | | skipped (GH-19325)
* bpo-40275: Avoid importing socket in test.support (GH-19603)Serhiy Storchaka2020-04-251-1/+2
| | | | | | * Move socket related functions from test.support to socket_helper. * Import socket, nntplib and urllib.error lazily in transient_internet(). * Remove importing multiprocess.
* bpo-40138: Fix Windows os.waitpid() for large exit code (GH-19637)Victor Stinner2020-04-221-21/+51
| | | | | | | | Fix the Windows implementation of os.waitpid() for exit code larger than "INT_MAX >> 8". The exit status is now interpreted as an unsigned number. os.waitstatus_to_exitcode() now accepts wait status larger than INT_MAX.