Skip to content

Commit a2c0552

Browse files
committed
Fix py_schedule_SUITE tests failing on FreeBSD
Bind to a specific context in init_per_suite to ensure exec/eval use the same Python namespace. On FreeBSD, scheduler-based routing could route calls to different contexts if the test process migrates between schedulers.
1 parent cd613fa commit a2c0552

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/py_schedule_SUITE.erl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ all() ->
3838
init_per_suite(Config) ->
3939
{ok, _} = application:ensure_all_started(erlang_python),
4040
{ok, _} = py:start_contexts(),
41+
%% Bind to a specific context to ensure exec/eval use the same namespace
42+
%% (scheduler-based routing may use different contexts on some platforms)
43+
Ctx = py_context_router:get_context(1),
44+
py_context_router:bind_context(Ctx),
4145
%% Register a test callback for schedule() tests
4246
py_callback:register(<<"_test_add">>, fun([A, B]) -> A + B end),
4347
py_callback:register(<<"_test_mul">>, fun([A, B]) -> A * B end),
@@ -46,6 +50,7 @@ init_per_suite(Config) ->
4650
Config.
4751

4852
end_per_suite(_Config) ->
53+
py_context_router:unbind_context(),
4954
py_callback:unregister(<<"_test_add">>),
5055
py_callback:unregister(<<"_test_mul">>),
5156
py_callback:unregister(<<"_test_echo">>),

0 commit comments

Comments
 (0)