@@ -964,7 +964,7 @@ def func_that_relies_on_dynamic_module(v=None):
964964 # x's value in the second function, it will be overriden by the
965965 # initial value of x in the child environment
966966
967- with open ('first_function .pk' , 'wb' ) as fid :
967+ with open ('function_with_initial_globals .pk' , 'wb' ) as fid :
968968 cloudpickle .dump (mod .func_that_relies_on_dynamic_module , fid )
969969
970970 # change the mod's global variable x
@@ -979,37 +979,38 @@ def func_that_relies_on_dynamic_module(v=None):
979979 child_process_code = """
980980 import pickle
981981
982- with open('first_function .pk','rb') as fid:
983- first_f = pickle.load(fid)
982+ with open('function_with_initial_globals .pk','rb') as fid:
983+ function_with_initial_globals = pickle.load(fid)
984984
985985 # at this point, a module called 'mod' should exist in
986986 # _dynamic_modules_globals. further function loading
987987 # will use the globals living in mod
988988
989- assert first_f () == 1
989+ assert function_with_initial_globals () == 1
990990
991991 # load a function with initial global variable x set to 2
992992 with open('function_with_modified_globals.pk','rb') as fid:
993- new_f = pickle.load(fid)
993+ function_with_modified_globals = pickle.load(fid)
994994
995995 # assert the initial global got overridden by
996996 # _dynamic_modules_globals
997- assert new_f ()==1
997+ assert function_with_modified_globals ()==1
998998
999999 # both function's global x should point to the
1000- # same variable. calling first_f('test_value')
1001- # will change this variable, and new_f() should
1002- # return the changed variable
1003- assert first_f('test_value') == 'test_value'
1004- assert new_f() == 'test_value'
1000+ # same variable.
1001+ # calling function_with_initial_globals('test_value')
1002+ # will change this variable: function_with_modified_globals()
1003+ # should return the changed variable
1004+ assert function_with_initial_globals('test_value') == 'test_value'
1005+ assert function_with_modified_globals() == 'test_value'
10051006 """
10061007
10071008 # finally, we execute the code
10081009 assert_run_python_script (textwrap .dedent (child_process_code ))
10091010
10101011 finally :
10111012 # remove the created files
1012- os .unlink ('first_function .pk' )
1013+ os .unlink ('function_with_initial_globals .pk' )
10131014 os .unlink ('function_with_modified_globals.pk' )
10141015
10151016 @pytest .mark .skipif (sys .version_info >= (3 , 0 ),
0 commit comments