Unfortunately different OSs (and possibly Python implementations as well) have different interpretations of what it means to set an evironment variable to an empty string. Some (e.g. Windows) interpret it as unsetting the variable and some (e.g. AIX or Darwin) actually set it to a
()
| 234 | ############################################################################### |
| 235 | |
| 236 | def _canSetEmptyEnvironmentVariable(): |
| 237 | """ |
| 238 | Unfortunately different OSs (and possibly Python implementations as well) |
| 239 | have different interpretations of what it means to set an evironment |
| 240 | variable to an empty string. Some (e.g. Windows) interpret it as unsetting |
| 241 | the variable and some (e.g. AIX or Darwin) actually set it to an empty |
| 242 | string. |
| 243 | |
| 244 | """ |
| 245 | dummyName = "UGNABUNGA_FOO_BAR_BAZ_FEE_FAE_FOU_FAM" |
| 246 | original = os.environ.get(dummyName) |
| 247 | _env_set(dummyName, "") |
| 248 | result = _getExternalEnv(dummyName) == "" |
| 249 | _env_set(dummyName, original) |
| 250 | return result |
| 251 | |
| 252 | |
| 253 | def _env_del(name): |
no test coverage detected