mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
* chore: handle null for `py::scoped_critical_section` * test: add tests for `py::scoped_critical_section` * test: use assert instead of REQUIRE * feat: enable faulthandler for pytest * chore: use `__has_include(<barrier>)` * fix: fix segmentation fault in test * fix: test critical_section for no-gil only * test: run new tests only * test: ensure non-empty test selection * fix: fix test critical_section * fix: change Python 3.14.0b1/2 xfail tests to non-strict * test: trigger gc manually * test: mark xfail to `DynamicClass` * Use `namespace test_scoped_critical_section_ns` (standard approach to guard against name clashes). * Simplify changes in pybind11/critical_section.h and add test_nullptr_combinations() * test: disable Python devmode in pytest * test: add comprehensive comments for the tests * test: add a summary comment for tests * refactor: simpler impl Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com> Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
31 lines
819 B
Python
31 lines
819 B
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from pybind11_tests import scoped_critical_section as m
|
|
|
|
|
|
def test_nullptr_combinations():
|
|
m.test_one_nullptr()
|
|
m.test_two_nullptrs()
|
|
m.test_first_nullptr()
|
|
m.test_second_nullptr()
|
|
|
|
|
|
@pytest.mark.skipif(not m.has_barrier, reason="no <barrier>")
|
|
def test_scoped_critical_section() -> None:
|
|
for _ in range(64):
|
|
m.test_scoped_critical_section()
|
|
|
|
|
|
@pytest.mark.skipif(not m.has_barrier, reason="no <barrier>")
|
|
def test_scoped_critical_section2() -> None:
|
|
for _ in range(64):
|
|
m.test_scoped_critical_section2()
|
|
|
|
|
|
@pytest.mark.skipif(not m.has_barrier, reason="no <barrier>")
|
|
def test_scoped_critical_section2_same_object_no_deadlock() -> None:
|
|
for _ in range(64):
|
|
m.test_scoped_critical_section2_same_object_no_deadlock()
|