File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
- import pytest
4
3
import os
5
4
import pickle
6
5
6
+ import pytest
7
+
8
+
7
9
def test_interpreters ():
8
10
"""Makes sure the internals object differs across subinterpreters"""
9
11
@@ -37,20 +39,23 @@ def test_interpreters():
37
39
interp2 = i .create ()
38
40
try :
39
41
pipei , pipeo = os .pipe ()
40
- i .run_string (interp1 , code , shared = {' pipeo' : pipeo })
41
- with open (pipei , 'rb' ) as f :
42
+ i .run_string (interp1 , code , shared = {" pipeo" : pipeo })
43
+ with open (pipei , "rb" ) as f :
42
44
res1 = pickle .load (f )
43
45
44
46
pipei , pipeo = os .pipe ()
45
- i .run_string (interp2 , code , shared = {' pipeo' : pipeo })
46
- with open (pipei , 'rb' ) as f :
47
+ i .run_string (interp2 , code , shared = {" pipeo" : pipeo })
48
+ with open (pipei , "rb" ) as f :
47
49
res2 = pickle .load (f )
48
50
49
51
# do this while the two interpreters are active
50
52
import mod_test_interpreters as m2
53
+
51
54
print (dir (m ))
52
55
print (dir (m2 ))
53
- assert m .internals_at () == m2 .internals_at (), "internals should be the same within the main interpreter"
56
+ assert m .internals_at () == m2 .internals_at (), (
57
+ "internals should be the same within the main interpreter"
58
+ )
54
59
finally :
55
60
i .destroy (interp1 )
56
61
i .destroy (interp2 )
You can’t perform that action at this time.
0 commit comments