@@ -96,9 +96,6 @@ public static void GetProgramNameDefault()
9696 /// Test default behavior of PYTHONHOME. If ENVVAR is set it will
9797 /// return the same value. If not, returns EmptyString.
9898 /// </summary>
99- /// <remarks>
100- /// AppVeyor.yml has been update to tests with ENVVAR set.
101- /// </remarks>
10299 [ Test ]
103100 public static void GetPythonHomeDefault ( )
104101 {
@@ -114,22 +111,19 @@ public static void GetPythonHomeDefault()
114111 [ Test ]
115112 public void SetPythonHome ( )
116113 {
117- // We needs to ensure that engine was started and shutdown at least once before setting dummy home.
118- // Otherwise engine will not run with dummy path with random problem.
119- if ( ! PythonEngine . IsInitialized )
120- {
121- PythonEngine . Initialize ( ) ;
122- }
123-
114+ PythonEngine . Initialize ( ) ;
115+ var pythonHomeBackup = PythonEngine . PythonHome ;
124116 PythonEngine . Shutdown ( ) ;
125117
126- var pythonHomeBackup = PythonEngine . PythonHome ;
118+ if ( pythonHomeBackup == "" )
119+ Assert . Inconclusive ( "Can't reset PythonHome to empty string, skipping" ) ;
127120
128121 var pythonHome = "/dummypath/" ;
129122
130123 PythonEngine . PythonHome = pythonHome ;
131124 PythonEngine . Initialize ( ) ;
132125
126+ Assert . AreEqual ( pythonHome , PythonEngine . PythonHome ) ;
133127 PythonEngine . Shutdown ( ) ;
134128
135129 // Restoring valid pythonhome.
@@ -139,15 +133,12 @@ public void SetPythonHome()
139133 [ Test ]
140134 public void SetPythonHomeTwice ( )
141135 {
142- // We needs to ensure that engine was started and shutdown at least once before setting dummy home.
143- // Otherwise engine will not run with dummy path with random problem.
144- if ( ! PythonEngine . IsInitialized )
145- {
146- PythonEngine . Initialize ( ) ;
147- }
136+ PythonEngine . Initialize ( ) ;
137+ var pythonHomeBackup = PythonEngine . PythonHome ;
148138 PythonEngine . Shutdown ( ) ;
149139
150- var pythonHomeBackup = PythonEngine . PythonHome ;
140+ if ( pythonHomeBackup == "" )
141+ Assert . Inconclusive ( "Can't reset PythonHome to empty string, skipping" ) ;
151142
152143 var pythonHome = "/dummypath/" ;
153144
@@ -161,6 +152,26 @@ public void SetPythonHomeTwice()
161152 PythonEngine . PythonHome = pythonHomeBackup ;
162153 }
163154
155+ [ Test ]
156+ [ Ignore ( "Currently buggy in Python" ) ]
157+ public void SetPythonHomeEmptyString ( )
158+ {
159+ PythonEngine . Initialize ( ) ;
160+
161+ var backup = PythonEngine . PythonHome ;
162+ if ( backup == "" )
163+ {
164+ PythonEngine . Shutdown ( ) ;
165+ Assert . Inconclusive ( "Can't reset PythonHome to empty string, skipping" ) ;
166+ }
167+ PythonEngine . PythonHome = "" ;
168+
169+ Assert . AreEqual ( "" , PythonEngine . PythonHome ) ;
170+
171+ PythonEngine . PythonHome = backup ;
172+ PythonEngine . Shutdown ( ) ;
173+ }
174+
164175 [ Test ]
165176 public void SetProgramName ( )
166177 {
@@ -207,7 +218,7 @@ public void SetPythonPath()
207218 // The list sys.path is initialized with this value on interpreter startup;
208219 // it can be (and usually is) modified later to change the search path for loading modules.
209220 // See https://docs.python.org/3/c-api/init.html#c.Py_GetPath
210- // After PythonPath is set, then PythonEngine.PythonPath will correctly return the full search path.
221+ // After PythonPath is set, then PythonEngine.PythonPath will correctly return the full search path.
211222
212223 PythonEngine . Shutdown ( ) ;
213224
0 commit comments