File: test_scoped_critical_section.py

package info (click to toggle)
pybind11 3.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,448 kB
  • sloc: cpp: 27,239; python: 13,512; ansic: 4,244; makefile: 204; sh: 36
file content (30 lines) | stat: -rw-r--r-- 819 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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()