def test_unsetenv(self): #CPython nt has no unsetenv function #simple sanity check if is_cli: nt.putenv("ipy_test_env_var", "xyz") nt.unsetenv("ipy_test_env_var_unset") self.assertTrue(not nt.environ.has_key("ipy_test_env_var_unset"))
def test_unsetenv(): #CPython nt has no unsetenv function #simple sanity check if is_cli: nt.putenv("ipy_test_env_var", "xyz") nt.unsetenv("ipy_test_env_var_unset") Assert("ipy_test_env_var_unset" not in nt.environ)
def test_unsetenv(): #CPython nt has no unsetenv function #simple sanity check if is_cli: nt.putenv("ipy_test_env_var", "xyz") nt.unsetenv("ipy_test_env_var_unset") Assert(not nt.environ.has_key("ipy_test_env_var_unset"))
def test_putenv(): ''' ''' #simple sanity check nt.putenv("IPY_TEST_ENV_VAR", "xyz") #ensure it really does what it claims to do Assert("IPY_TEST_ENV_VAR" not in nt.environ) #negative cases AssertError(TypeError, nt.putenv, None, "xyz") #BUG #AssertError(TypeError, nt.putenv, "ABC", None) AssertError(TypeError, nt.putenv, 1, "xyz") AssertError(TypeError, nt.putenv, "ABC", 1)
def test_putenv(): ''' ''' #simple sanity check nt.putenv("IPY_TEST_ENV_VAR", "xyz") #ensure it really does what it claims to do Assert(not nt.environ.has_key("IPY_TEST_ENV_VAR")) #negative cases AssertError(TypeError, nt.putenv, None, "xyz") #BUG #AssertError(TypeError, nt.putenv, "ABC", None) AssertError(TypeError, nt.putenv, 1, "xyz") AssertError(TypeError, nt.putenv, "ABC", 1)
def test_putenv(self): ''' ''' #simple sanity check nt.putenv("IPY_TEST_ENV_VAR", "xyz") #ensure it really does what it claims to do self.assertTrue(not nt.environ.has_key("IPY_TEST_ENV_VAR")) #negative cases self.assertRaises(TypeError, nt.putenv, None, "xyz") #BUG #self.assertRaises(TypeError, nt.putenv, "ABC", None) self.assertRaises(TypeError, nt.putenv, 1, "xyz") self.assertRaises(TypeError, nt.putenv, "ABC", 1)
def test_putenv_invalid_name(): with pytest.raises(ValueError): posix.putenv("foo=bar", "xxx")
import sys import nt from iptest.cominterop_util import is_pywin32 if not is_pywin32: print("pywin32 is not installed. Skipping this test.") sys.exit(0) if sys.platform == "win32": #Make sure we'll have access to pywin32 if sys.prefix + "\\Lib" not in sys.path: sys.path.append(sys.prefix + "\\Lib") #Make sure we'll have access to cominterop_util if "." not in sys.path: sys.path.append(".") #Next make sure pywintypes25.dll is in %Path% cpy_location = nt.environ["SystemDrive"] + "\\Python" + sys.winver.replace( ".", "") if cpy_location not in nt.environ["Path"]: nt.putenv("Path", nt.environ["Path"] + ";" + cpy_location) if sys.platform == "win32": #At this point it should be possible to install the pywin32com server from .hw import install_pywin32_server install_pywin32_server() #--Run tests------------------------------------------------------------------- #TODO
def test_unsetenv(self): #simple sanity check nt.putenv("ipy_test_env_var", "xyz") nt.unsetenv("ipy_test_env_var_unset") self.assertFalse("ipy_test_env_var_unset" in nt.environ)
import sys import nt from iptest.cominterop_util import is_pywin32 if not is_pywin32: print "pywin32 is not installed. Skipping this test." sys.exit(0) if sys.platform=="win32": #Make sure we'll have access to pywin32 if sys.prefix + "\\Lib" not in sys.path: sys.path.append(sys.prefix + "\\Lib") #Make sure we'll have access to cominterop_util if "." not in sys.path: sys.path.append(".") #Next make sure pywintypes25.dll is in %Path% cpy_location = nt.environ["SystemDrive"] + "\\Python" + sys.winver.replace(".", "") if cpy_location not in nt.environ["Path"]: nt.putenv("Path", nt.environ["Path"] + ";" + cpy_location) if sys.platform=="win32": #At this point it should be possible to install the pywin32com server from hw import install_pywin32_server install_pywin32_server() #--Run tests------------------------------------------------------------------- #TODO