summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posix.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-95023: Added os.setns and os.unshare functions (#95046)Noam Cohen2022-10-201-0/+47
| | | | | | | | Added os.setns and os.unshare to easily switch between namespaces on Linux. Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-98393: os module reject bytes-like, only accept bytes (#98394)Victor Stinner2022-10-181-6/+3
| | | | | 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-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK (GH-97944)Ned Deily2022-10-061-0/+22
| | | | | | | | The macOS 13 SDK includes support for the `mkfifoat` and `mknodat` system calls. Using the `dir_fd` option with either `os.mkfifo` or `os.mknod` could result in a segfault if cpython is built with the macOS 13 SDK but run on an earlier version of macOS. Prevent this by adding runtime support for detection of these system calls ("weaklinking") as is done for other newer syscalls on macOS.
* gh-84461: Fix Emscripten umask and permission issues (GH-94002)Christian Heimes2022-06-191-0/+3
| | | | | | | | - Emscripten's default umask is too strict, see https://github.com/emscripten-core/emscripten/issues/17269 - getuid/getgid and geteuid/getegid are stubs that always return 0 (root). Disable effective uid/gid syscalls and fix tests that use chmod() current user. - Cannot drop X bit from directory.
* gh-90473: Make chmod a dummy on WASI, skip chmod tests (GH-93534)Christian Heimes2022-06-061-1/+3
| | | WASI does not have the ``chmod(2)`` syscall yet.
* gh-90473: Skip POSIX tests that don't apply to WASI (GH-93536)Christian Heimes2022-06-061-2/+9
|
* bpo-45046: Support context managers in unittest (GH-28045)Serhiy Storchaka2022-05-081-9/+3
| | | | | | Add methods enterContext() and enterClassContext() in TestCase. Add method enterAsyncContext() in IsolatedAsyncioTestCase. Add function enterModuleContext().
* bpo-47205: Skip error check of sched_get/setaffinity on FreeBSD (GH-32285)Christian Heimes2022-04-031-2/+6
|
* bpo-40280: Skip more tests/features that don't apply to Emscripten (GH-31791)Christian Heimes2022-03-101-3/+11
| | | | | | | - 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-3/+7
| | | | | | | | | - 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-46933: Make pwd module optional (GH-31700)Christian Heimes2022-03-071-1/+6
| | | Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* bpo-40280: Address more test failures on Emscripten (GH-31050)Christian Heimes2022-02-051-4/+5
| | | Co-authored-by: Brett Cannon <brett@python.org>
* bpo-46426: Improve tests for the dir_fd argument (GH-30668)Serhiy Storchaka2022-01-211-222/+195
| | | | | | | 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.
* bpo-45229: Remove test_main in many tests (GH-28405)Serhiy Storchaka2021-09-191-12/+4
| | | | | | | | | Instead of explicitly enumerate test classes for run_unittest() use the unittest ability to discover tests. This also makes these tests discoverable and runnable with unittest. load_tests() can be used for dynamic generating tests and adding doctests. setUpModule(), tearDownModule() and addModuleCleanup() can be used for running code before and after all module tests.
* bpo-43568: Drop support for MACOSX_DEPLOYMENT_TARGET < 10.3 (GH-25827)Ned Deily2021-05-031-1/+1
| | | | | | | | | | Only complain if the config target is >= 10.3 and the current target is < 10.3. The check was originally added to ensure that incompatible LDSHARED flags are not used, because -undefined dynamic_lookup is used when building for 10.3 and later, and is not supported on older OS versions. Apart from that, there should be no problem in general with using an older target. Authored-by: Joshua Root <jmr@macports.org>
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25190)Inada Naoki2021-04-061-9/+9
| | | | | | * Fix test_lzma * Fix test_mailbox * Fix test_mimetypes * Fix test_posix
* bpo-42504: Ensure that get_config_var('MACOSX_DEPLOYMENT_TARGET') is a ↵Ronald Oussoren2021-02-011-1/+1
| | | | | string (GH-24341) * bpo-42504: Ensure that get_config_var('MACOSX_DEPLOYMENT_TARGET') is a string
* bpo-31904: Skip some tests of changing owner in _test_all_chown_common() on ↵pxinwr2020-12-151-2/+11
| | | | VxWorks (GH-23716)
* bpo-31904: Disable os.popen and popen test cases on VxWorks (GH-21687)pxinwr2020-12-151-0/+1
|
* bpo-41443: Add more attribute checking in test_posix (GH-21688)pxinwr2020-12-081-3/+7
|
* bpo-42504: fix for MACOSX_DEPLOYMENT_TARGET=11 (GH-23556)FX Coudert2020-12-031-1/+1
| | | | macOS releases numbering has changed as of macOS 11 Big Sur. Previously, major releases were of the form 10.x, 10.x+1, 10.x+2, etc; as of Big Sur, they are now x, x+1, etc, so, for example, 10.15, 10.15.1, ..., 10.15.7, 11, 11.0.1, 11.1, ..., 12, 12.1, etc. Allow Python to build with single-digit deployment target values. Patch provided by FX Coudert.
* bpo-31904: Fix fifo test cases for VxWorks (GH-20254)pxinwr2020-12-011-4/+9
|
* bpo-41100: Support macOS 11 and Apple Silicon (GH-22855)Ronald Oussoren2020-11-081-0/+228
| | | | | | | | | | | Co-authored-by: Lawrence D’Anna <lawrence_danna@apple.com> * Add support for macOS 11 and Apple Silicon (aka arm64) As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy * Support building on recent versions of macOS while deploying to older versions This allows building installers on macOS 11 while still supporting macOS 10.9.
* bpo-40275: Use new test.support helper submodules in tests (GH-21451)Hai Shi2020-08-031-169/+189
|
* bpo-40094: Add test.support.wait_process() (GH-19254)Victor Stinner2020-03-311-26/+25
| | | | | | | | | Moreover, the following tests now check the child process exit code: * test_os.PtyTests * test_mailbox.test_lock_conflict() * test_tempfile.test_process_awareness() * test_uuid.testIssue8621() * multiprocessing resource tracker tests
* bpo-39395: putenv() and unsetenv() always available (GH-18135)Victor Stinner2020-01-241-1/+0
| | | | | | | | The os.putenv() and os.unsetenv() functions are now always available. On non-Windows platforms, Python now requires setenv() and unsetenv() functions to build. Remove putenv_dict from posixmodule.c: it's not longer needed.
* bpo-38692: Skip test_posix.test_pidfd_open() on EPERM (GH-17290)Victor Stinner2019-11-211-0/+2
| | | | | | Skip the test_posix.test_pidfd_open() test if os.pidfd_open() fails with a PermissionError. This situation can happen in a Linux sandbox using a syscall whitelist which doesn't allow the pidfd_open() syscall yet (like systemd-nspawn).
* bpo-38692: Add os.pidfd_open. (GH-17063)Benjamin Peterson2019-11-061-0/+9
|
* bpo-38493: Add os.CLD_KILLED and os.CLD_STOPPED. (GH-16821)Dong-hee Na2019-10-211-0/+10
|
* closes bpo-37420: Handle errors during iteration in os.sched_setaffinity. ↵Brandt Bucher2019-06-271-0/+1
| | | | (GH-14414)
* bpo-35537: Rewrite setsid test for os.posix_spawn (GH-11721)Victor Stinner2019-06-141-16/+28
| | | | bpo-35537, bpo-35876: Fix also test_start_new_session() of test_subprocess: use os.getsid() rather than os.getpgid().
* Fix test_posix if RWF_HIPRI is defined but not preadv2. (GH-13980)Benjamin Peterson2019-06-111-0/+2
| | | If preadv2 is not available, preadv will raise NotImplementedError.
* bpo-36814: ensure os.posix_spawn() handles None (GH-13144)Anthony Shaw2019-05-101-0/+9
| | | | Fix an issue where os.posix_spawn() would incorrectly raise a TypeError when file_actions is None.
* Skip test_preadv_flags if RWF_HIPRI is not supported by the system (GH-12762)Pablo Galindo2019-04-131-0/+8
|
* Clean up code which checked presence of os.{stat,lstat,chmod} (#11643)Anthony Sottile2019-02-251-5/+1
|
* bpo-35537: Skip test_start_new_session() of posix_spawn (GH-11718)Victor Stinner2019-02-011-0/+2
| | | The test fails. Skip the test until a fix can be found.
* bpo-35537: Add setsid parameter to os.posix_spawn() and os.posix_spawnp() ↵Joannah Nanjekye2019-02-011-0/+16
| | | | (GH-11608)
* bpo-35794: Catch PermissionError in test_no_such_executable (GH-11635)Pablo Galindo2019-01-211-1/+3
| | | | PermissionError can be raised if there are directories in the $PATH that are not accessible when using posix_spawnp.
* bpo-35674: Add os.posix_spawnp() (GH-11554)Joannah Nanjekye2019-01-161-71/+119
| | | Add a new os.posix_spawnp() function.
* bpo-35568: add 'raise_signal' function (GH-11335)Vladimir Matveev2019-01-081-4/+4
| | | | | | As in title, expose C `raise` function as `raise_function` in `signal` module. Also drop existing `raise_signal` in `_testcapi` module and replace all usages with new function. https://bugs.python.org/issue35568
* bpo-34685: Skip posix_spawn scheduler tests on BSD (GH-9316)Pablo Galindo2018-09-141-6/+10
| | | * Skip posix_spawn scheduler tests on BSD. We were already skyping similar tests as the behaviour can depend on the implementation in some cases.
* closes bpo-34650: Check if sched_getscheduler returns ENOSYS before ↵Benjamin Peterson2018-09-121-3/+15
| | | | | declaring it supported. (GH-9228) musl doesn't support the scheduler API, but declares stubs that alway return ENOSYS.
* bpo-20104: Change the file_actions parameter of os.posix_spawn(). (GH-6725)Serhiy Storchaka2018-09-081-29/+28
| | | | | * Make its default value an empty tuple instead of None. * Make it a keyword-only parameter.
* bpo-20104: Add flag capabilities to posix_spawn (GH-6693)Pablo Galindo2018-09-071-0/+143
| | | Implement the "attributes objects" parameter of `os.posix_spawn` to complete the implementation and fully cover the underlying API.
* Fix TestPosixSpawn.test_close_file() (GH-8992)Victor Stinner2018-08-291-30/+34
| | | | | | | | Modify TestPosixSpawn to run Python using -I and -S options. Disable site module to avoid side effects. For example, on Fedora 28, if the HOME environment variable is not set, site._getuserbase() calls pwd.getpwuid() which opens /var/lib/sss/mc/passwd, but then leaves the file open which makes test_close_file() to fail.
* bpo-33871: Fix os.sendfile(), os.writev(), os.readv(), etc. (GH-7931)Serhiy Storchaka2018-07-311-0/+53
| | | | | | | | | | | | * Fix integer overflow in os.readv(), os.writev(), os.preadv() and os.pwritev() and in os.sendfile() with headers or trailers arguments (on BSD-based OSes and MacOS). * Fix sending the part of the file in os.sendfile() on MacOS. Using the trailers argument could cause sending more bytes from the input file than was specified. Thanks Ned Deily for testing on 32-bit MacOS.
* bpo-31044, test_posix: Reenable makedev() tests on FreeBSD (#7449)Victor Stinner2018-06-061-5/+0
| | | | | | The bug has been fixed 10 months ago: * https://svnweb.freebsd.org/base?view=revision&revision=321920 * https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221048
* bpo-33655: Also ignore test_posix_fallocate failures on BSD platforms (GH-7134)Ned Deily2018-05-261-1/+6
| | | | The failure may be due to the use oF ZFS, a case we already ignore for Solaris-based systems where ZFS is frequently used.
* bpo-33455: Pass os.environ in test_posix::test_specify_environment. (GH-6753)Miro Hrončok2018-05-111-1/+1
| | | | | | Pass os.environ's copy to new process created at test_posix: test_specify_environment. Otherwise important variables such as LD_LIBRARY_PATH are not set and the child process might not work at all in an environment where such variables are required for Python to function.
* bpo-20104: Improve error handling and fix a reference leak in ↵Serhiy Storchaka2018-05-011-17/+160
| | | | os.posix_spawn(). (#6332)