Skip to content

Commit 461761a

Browse files
committed
Revert file moves
1 parent fab140e commit 461761a

6 files changed

Lines changed: 29 additions & 45 deletions

File tree

tests/CMakeLists.txt

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ set(PYBIND11_TEST_FILES
157157
test_methods_and_attributes
158158
test_modules
159159
test_multiple_inheritance
160-
test_multiple_interpreters/test_multiple_interpreters.py
160+
test_multiple_interpreters.py
161161
test_native_enum
162162
test_numpy_array
163163
test_numpy_dtypes
@@ -578,8 +578,34 @@ add_custom_target(
578578
USES_TERMINAL)
579579

580580
if(NOT PYBIND11_CUDA_TESTS)
581-
# Multiple interpreters tests are in a separate subdirectory
582-
add_subdirectory(test_multiple_interpreters)
581+
set(PYBIND11_MULTIPLE_INTERPRETERS_TEST_FILES test_multiple_interpreters.py)
582+
583+
set(PYBIND11_MULTIPLE_INTERPRETERS_TEST_MODULES
584+
mod_per_interpreter_gil mod_shared_interpreter_gil mod_per_interpreter_gil_with_singleton)
585+
586+
# These modules don't get mixed with other test modules because those aren't subinterpreter safe.
587+
foreach(mod IN LISTS PYBIND11_MULTIPLE_INTERPRETERS_TEST_MODULES)
588+
pybind11_add_module("${mod}" THIN_LTO "${mod}.cpp")
589+
pybind11_enable_warnings("${mod}")
590+
endforeach()
591+
592+
# Put the built modules next to `pybind11_tests.so` so that the test scripts can find them.
593+
get_target_property(pybind11_tests_output_directory pybind11_tests LIBRARY_OUTPUT_DIRECTORY)
594+
foreach(mod IN LISTS PYBIND11_MULTIPLE_INTERPRETERS_TEST_MODULES)
595+
set_target_properties("${mod}" PROPERTIES LIBRARY_OUTPUT_DIRECTORY
596+
"${pybind11_tests_output_directory}")
597+
endforeach()
598+
599+
if(PYBIND11_TEST_SMART_HOLDER)
600+
foreach(mod IN LISTS PYBIND11_MULTIPLE_INTERPRETERS_TEST_MODULES)
601+
target_compile_definitions(
602+
"${mod}"
603+
PUBLIC
604+
-DPYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE)
605+
endforeach()
606+
endif()
607+
608+
add_dependencies(pytest ${PYBIND11_MULTIPLE_INTERPRETERS_TEST_MODULES})
583609
endif()
584610

585611
if(PYBIND11_TEST_OVERRIDE)

tests/test_multiple_interpreters/mod_per_interpreter_gil.cpp renamed to tests/mod_per_interpreter_gil.cpp

File renamed without changes.

tests/test_multiple_interpreters/mod_per_interpreter_gil_with_singleton.cpp renamed to tests/mod_per_interpreter_gil_with_singleton.cpp

File renamed without changes.

tests/test_multiple_interpreters/mod_shared_interpreter_gil.cpp renamed to tests/mod_shared_interpreter_gil.cpp

File renamed without changes.

tests/test_multiple_interpreters/test_multiple_interpreters.py renamed to tests/test_multiple_interpreters.py

File renamed without changes.

tests/test_multiple_interpreters/CMakeLists.txt

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)