@@ -839,9 +839,16 @@ def test_bad_script(self):
839839 interp .exec (10 )
840840
841841 def test_bytes_for_script (self ):
842+ r , w = self .pipe ()
843+ RAN = b'R'
844+ DONE = b'D'
842845 interp = interpreters .create ()
843- with self .assertRaises (TypeError ):
844- interp .exec (b'print("spam")' )
846+ interp .exec (f"""if True:
847+ import os
848+ os.write({ w } , { RAN !r} )
849+ """ )
850+ os .write (w , DONE )
851+ self .assertEqual (os .read (r , 1 ), RAN )
845852
846853 def test_with_background_threads_still_running (self ):
847854 r_interp , w_interp = self .pipe ()
@@ -1010,8 +1017,8 @@ def test_call(self):
10101017
10111018 for i , (callable , args , kwargs ) in enumerate ([
10121019 (call_func_noop , (), {}),
1013- (call_func_return_shareable , (), {}),
1014- (call_func_return_not_shareable , (), {}),
1020+ # (call_func_return_shareable, (), {}),
1021+ # (call_func_return_not_shareable, (), {}),
10151022 (Spam .noop , (), {}),
10161023 ]):
10171024 with self .subTest (f'success case #{ i + 1 } ' ):
@@ -1036,6 +1043,8 @@ def test_call(self):
10361043 (call_func_complex , ('custom' , 'spam!' ), {}),
10371044 (call_func_complex , ('custom-inner' , 'eggs!' ), {}),
10381045 (call_func_complex , ('???' ,), {'exc' : ValueError ('spam' )}),
1046+ (call_func_return_shareable , (), {}),
1047+ (call_func_return_not_shareable , (), {}),
10391048 ]):
10401049 with self .subTest (f'invalid case #{ i + 1 } ' ):
10411050 with self .assertRaises (Exception ):
@@ -1051,8 +1060,8 @@ def test_call_in_thread(self):
10511060
10521061 for i , (callable , args , kwargs ) in enumerate ([
10531062 (call_func_noop , (), {}),
1054- (call_func_return_shareable , (), {}),
1055- (call_func_return_not_shareable , (), {}),
1063+ # (call_func_return_shareable, (), {}),
1064+ # (call_func_return_not_shareable, (), {}),
10561065 (Spam .noop , (), {}),
10571066 ]):
10581067 with self .subTest (f'success case #{ i + 1 } ' ):
@@ -1079,6 +1088,8 @@ def test_call_in_thread(self):
10791088 (call_func_complex , ('custom' , 'spam!' ), {}),
10801089 (call_func_complex , ('custom-inner' , 'eggs!' ), {}),
10811090 (call_func_complex , ('???' ,), {'exc' : ValueError ('spam' )}),
1091+ (call_func_return_shareable , (), {}),
1092+ (call_func_return_not_shareable , (), {}),
10821093 ]):
10831094 with self .subTest (f'invalid case #{ i + 1 } ' ):
10841095 if args or kwargs :
@@ -1610,8 +1621,10 @@ def test_exec(self):
16101621 def test_call (self ):
16111622 with self .subTest ('no args' ):
16121623 interpid = _interpreters .create ()
1613- exc = _interpreters .call (interpid , call_func_return_shareable )
1614- self .assertIs (exc , None )
1624+ with self .assertRaises (ValueError ):
1625+ _interpreters .call (interpid , call_func_return_shareable )
1626+ # exc = _interpreters.call(interpid, call_func_return_shareable)
1627+ # self.assertIs(exc, None)
16151628
16161629 with self .subTest ('uncaught exception' ):
16171630 interpid = _interpreters .create ()
0 commit comments