Skip to content

Commit

Permalink
test_c.py cannot import testing.support
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury committed Feb 19, 2025
1 parent 10d60f9 commit 16be1fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 7 additions & 3 deletions src/c/test_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import pytest
import sys
import testing.support
import typing as t

is_musl = False
Expand Down Expand Up @@ -3407,9 +3406,14 @@ def test_bitfield_as_ppc_gcc():


def buffer_warning(cdata):
testing.support.skip_if_multithreaded()

import threading
import warnings

# warnings.catch_warnings() is not currently thread-safe, so skip the
# remainder of this test if running with `pytest-run-parallel`.
if threading.current_thread() != threading.main_thread():
pytest.skip("cannot run in a secondary thread")

buf = buffer(cdata)
bytes = len(buf)
with warnings.catch_warnings(record=True) as w:
Expand Down
7 changes: 0 additions & 7 deletions testing/support.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys, os
import pytest
from cffi._imp_emulation import load_dynamic

if sys.version_info < (3,):
Expand Down Expand Up @@ -98,12 +97,6 @@ def typeof_disabled(*args, **kwds):
return module.lib


def skip_if_multithreaded():
import threading
if threading.current_thread() != threading.main_thread():
pytest.skip("cannot run in a secondary thread")


# For testing, we call gcc with "-Werror". This is fragile because newer
# versions of gcc are always better at producing warnings, particularly for
# auto-generated code. We need here to adapt and silence them as needed.
Expand Down

0 comments on commit 16be1fd

Please sign in to comment.