tests: always disable on the nogil build (#5701)

* docs: fix docs on visibilty preset hidden

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: always disable on the nogil build

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

* docs: mention skip reason in comment

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Henry Schreiner
2025-05-28 23:33:53 -04:00
committed by GitHub
parent 57e27c1ffc
commit a18b1bc4dc
2 changed files with 6 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
import multiprocessing
import sys
import sysconfig
import threading
import time
@@ -10,8 +11,11 @@ import pytest
import env
from pybind11_tests import gil_scoped as m
# Test collection seems to hold the gil
# These tests have rare flakes in nogil; since they
# are testing the gil, they are skipped at the moment.
skipif_not_free_threaded = pytest.mark.skipif(
not getattr(sys, "_is_gil_enabled", lambda: True)(),
sysconfig.get_config_var("Py_GIL_DISABLED"),
reason="Flaky without the GIL",
)