def test_appdata_unicode_deprecated(self): self.overrideEnv("APPDATA", "fakepath") s = win32utils.get_appdata_location() u = self.applyDeprecated(symbol_versioning.deprecated_in((2, 5, 0)), win32utils.get_appdata_location_unicode) self.assertEqual(s, u) self.assertIsInstance(s, unicode)
def test_appdata_matches_environment(self): # Typically the APPDATA environment variable will match # get_appdata_location # XXX - See bug 262874, which asserts the correct encoding is 'mbcs', encoding = osutils.get_user_encoding() env_val = os.environ.get("APPDATA", None) if not env_val: raise TestSkipped("No APPDATA environment variable exists") self.assertPathsEqual(win32utils.get_appdata_location(), env_val.decode(encoding))
batch_path = "bzr.bat" prefix = sys.exec_prefix try: ## # try to create scripts_dir = os.path.join(prefix, "Scripts") script_path = _quoted_path(os.path.join(scripts_dir, "bzr")) python_path = _quoted_path(os.path.join(prefix, "python.exe")) args = _win_batch_args() batch_str = "@%s %s %s" % (python_path, script_path, args) # support of win98 # if there is no HOME for bzr then set it for Bazaar manually base = os.environ.get('BZR_HOME', None) if base is None: base = win32utils.get_appdata_location() if base is None: base = os.environ.get('HOME', None) if base is None: base = os.path.splitdrive(sys.prefix)[0] + '\\' batch_str = ("@SET BZR_HOME=" + _quoted_path(base) + "\n" + batch_str) batch_path = os.path.join(scripts_dir, "bzr.bat") f = file(batch_path, "w") f.write(batch_str) f.close() file_created(batch_path) # registering manually created files for # auto-deinstallation procedure ## # inform user where batch launcher is.
def test_appdata_not_using_environment(self): # Test that we aren't falling back to the environment first = win32utils.get_appdata_location() self.overrideEnv("APPDATA", None) self.assertPathsEqual(first, win32utils.get_appdata_location())