Exemplo n.º 1
0
 def __init__(
     self,
     path: str,
     system_hgrc: Optional[str] = None,
     temp_mgr: Optional[TempFileManager] = None,
 ) -> None:
     """
     If hgrc is specified, it will be used as the value of the HGRCPATH
     environment variable when `hg` is run.
     """
     super().__init__(path)
     self.temp_mgr = temp_mgr or TempFileManager("hgrepo")
     self.hg_environment = os.environ.copy()
     # Drop any environment variables starting with 'HG'
     # to ensure the user's environment does not affect the tests.
     self.hg_environment = {
         k: v for k, v in os.environ.items() if not k.startswith("HG")
     }
     self.hg_environment["HGPLAIN"] = "1"
     self.hg_environment["HG_REAL_BIN"] = FindExe.HG_REAL
     self.hg_environment["NOSCMLOG"] = "1"
     self.hg_environment["LOCALE"] = "en_US.UTF-8"
     self.hg_environment["LC_ALL"] = "en_US.UTF-8"
     # Set HGRCPATH to make sure we aren't affected by the local system's
     # mercurial settings from /etc/mercurial/
     if system_hgrc:
         self.hg_environment["HGRCPATH"] = system_hgrc
     else:
         self.hg_environment["HGRCPATH"] = ""
     self.hg_bin = FindExe.HG
Exemplo n.º 2
0
    def setup(self) -> None:
        self.temp_mgr = TempFileManager()
        self.test_tmp = self.temp_mgr.make_temp_dir()

        hgrc_path = os.path.join(new_dir(), "global_hgrc")
        self.env = {
            "HGRCPATH": hgrc_path,
            "TESTTMP": str(self.test_tmp),
            "TEST_PROD_CONFIGS": "true",
        }
Exemplo n.º 3
0
 def __init__(self, path: str, temp_mgr: Optional[TempFileManager] = None) -> None:
     super().__init__(path)
     self.git_bin = FindExe.GIT  # pyre-ignore[8]: T38947910
     self.temp_mgr = temp_mgr or TempFileManager("gitrepo")
Exemplo n.º 4
0
def temporary_systemd_user_service_manager(
) -> typing.Iterator[SystemdUserServiceManager]:
    temp_mgr = TempFileManager()
    with temp_systemd(temp_mgr) as systemd:
        yield systemd
Exemplo n.º 5
0
 def __init__(self) -> None:
     # These are needed to satisfy pyre, but should never be used.
     self.temp_mgr = TempFileManager()
     self.test_tmp = Path("")
     self.env = {}