@@ -96,9 +96,6 @@ public static void GetProgramNameDefault()
96
96
/// Test default behavior of PYTHONHOME. If ENVVAR is set it will
97
97
/// return the same value. If not, returns EmptyString.
98
98
/// </summary>
99
- /// <remarks>
100
- /// AppVeyor.yml has been update to tests with ENVVAR set.
101
- /// </remarks>
102
99
[ Test ]
103
100
public static void GetPythonHomeDefault ( )
104
101
{
@@ -114,22 +111,19 @@ public static void GetPythonHomeDefault()
114
111
[ Test ]
115
112
public void SetPythonHome ( )
116
113
{
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 ;
124
116
PythonEngine . Shutdown ( ) ;
125
117
126
- var pythonHomeBackup = PythonEngine . PythonHome ;
118
+ if ( pythonHomeBackup == "" )
119
+ Assert . Inconclusive ( "Can't reset PythonHome to empty string, skipping" ) ;
127
120
128
121
var pythonHome = "/dummypath/" ;
129
122
130
123
PythonEngine . PythonHome = pythonHome ;
131
124
PythonEngine . Initialize ( ) ;
132
125
126
+ Assert . AreEqual ( pythonHome , PythonEngine . PythonHome ) ;
133
127
PythonEngine . Shutdown ( ) ;
134
128
135
129
// Restoring valid pythonhome.
@@ -139,15 +133,12 @@ public void SetPythonHome()
139
133
[ Test ]
140
134
public void SetPythonHomeTwice ( )
141
135
{
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 ;
148
138
PythonEngine . Shutdown ( ) ;
149
139
150
- var pythonHomeBackup = PythonEngine . PythonHome ;
140
+ if ( pythonHomeBackup == "" )
141
+ Assert . Inconclusive ( "Can't reset PythonHome to empty string, skipping" ) ;
151
142
152
143
var pythonHome = "/dummypath/" ;
153
144
@@ -161,6 +152,26 @@ public void SetPythonHomeTwice()
161
152
PythonEngine . PythonHome = pythonHomeBackup ;
162
153
}
163
154
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
+
164
175
[ Test ]
165
176
public void SetProgramName ( )
166
177
{
@@ -207,7 +218,7 @@ public void SetPythonPath()
207
218
// The list sys.path is initialized with this value on interpreter startup;
208
219
// it can be (and usually is) modified later to change the search path for loading modules.
209
220
// 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.
211
222
212
223
PythonEngine . Shutdown ( ) ;
213
224