File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+ import subprocess
3
+ import sys
4
+
5
+
6
+ def test_import_sage_all_in_fresh_interpreter ():
7
+ # Prepare a clean-ish environment, without any sage variables
8
+ env = os .environ .copy ()
9
+ env .pop ("PYTHONSTARTUP" , None )
10
+ for var in list (env ):
11
+ if var .startswith ("SAGE_" ):
12
+ env .pop (var , None )
13
+
14
+ proc = subprocess .run (
15
+ [sys .executable , "-c" , "import sage.all" ],
16
+ stdout = subprocess .PIPE ,
17
+ stderr = subprocess .PIPE ,
18
+ env = env ,
19
+ text = True , check = False ,
20
+ )
21
+ assert proc .returncode == 0 , (
22
+ "Importing 'sage.all' in a fresh interpreter failed.\n "
23
+ f"Return code: { proc .returncode } \n "
24
+ f"Stdout:\n { proc .stdout } \n "
25
+ f"Stderr:\n { proc .stderr } "
26
+ )
27
+ assert proc .stderr == ""
28
+ assert proc .stdout == ""
You can’t perform that action at this time.
0 commit comments