コード例 #1
0
 def make_info(self,
               sys_module=None,
               platform_module=None,
               filesystem_module=None,
               executive=None):
     return PlatformInfo(sys_module or fake_sys(), platform_module
                         or fake_platform(), filesystem_module
                         or MockFileSystem(), executive or fake_executive())
コード例 #2
0
 def __init__(self):
     self.executable = sys.executable
     self.executive = Executive()
     self.filesystem = FileSystem()
     self.user = User()
     self.platform = PlatformInfo(sys, platform, self.filesystem,
                                  self.executive)
     self.stdin = sys.stdin
     self.stdout = sys.stdout
     self.stderr = sys.stderr
     self.environ = os.environ
コード例 #3
0
    def __init__(self, fs, options, repo_root):
        self._fs = fs
        self._platform = PlatformInfo(sys, platform, fs, Executive())
        self._options = options
        _log.debug(options)
        self._repo_root = repo_root

        # The following fields are initialized in _create_basename_maps.
        self._basename_map = None
        self._basename_re_list = None
        self._idl_generated_impl_headers = None
        # _checked_in_header_re_list is used to distinguish checked-in
        # header files and generated header files.
        self._checked_in_header_re_list = None

        self._updated_files = []
コード例 #4
0
    def test_real_code(self):
        # This test makes sure the real (unmocked) code actually works.
        info = PlatformInfo(sys, platform, FileSystem(), Executive())
        self.assertNotEquals(info.os_name, '')
        self.assertNotEquals(info.os_version, '')
        self.assertNotEquals(info.display_name(), '')
        self.assertTrue(info.is_mac() or info.is_win() or info.is_linux()
                        or info.is_freebsd())
        self.assertIsNotNone(info.terminal_width())

        if info.is_linux():
            self.assertIsNotNone(info.linux_distribution())

        if info.is_mac():
            self.assertTrue(info.total_bytes_memory() > 0)
        else:
            self.assertIsNone(info.total_bytes_memory())
コード例 #5
0
 def __init__(self, platform_info=None):
     # We cannot get the PlatformInfo object from a SystemHost because
     # User is part of SystemHost itself.
     self._platform_info = platform_info or PlatformInfo(
         sys, platform, FileSystem(), Executive())