]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-124213: Skip tests failing inside systemd-nspawn --suppress-sync=true (#124215)
authorMichał Górny <mgorny@gentoo.org>
Fri, 20 Sep 2024 13:37:49 +0000 (15:37 +0200)
committerGitHub <noreply@github.com>
Fri, 20 Sep 2024 13:37:49 +0000 (13:37 +0000)
commit342e654b8eda24c68da64cc21bc9583e480d9e8e
treed28be64fdd9d7e5de97f215b11b4b5776a2593be
parent1a577729e347714eb819fa3a3a00149406c24e5e
gh-124213: Skip tests failing inside systemd-nspawn --suppress-sync=true (#124215)

Add a helper function that checks whether the test suite is running
inside a systemd-nspawn container, and skip the few tests failing
with `--suppress-sync=true` in that case.  The tests are failing because
`--suppress-sync=true` stubs out `fsync()`, `fdatasync()` and `msync()`
calls, and therefore they always return success without checking for
invalid arguments.

Call `os.open(__file__, os.O_RDONLY | os.O_SYNC)` and check the errno to
detect whether `--suppress-sync=true` is actually used, and skip
the tests only in that scenario.
Lib/test/support/__init__.py
Lib/test/test_mmap.py
Lib/test/test_os.py
Misc/NEWS.d/next/Tests/2024-09-18-18-39-21.gh-issue-124213.AQq_xg.rst [new file with mode: 0644]