Esempio n. 1
0
    def test_real_code(self):
        # This test makes sure the real (unmocked) code actually works.
        info = PlatformInfo(sys, platform, 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())

        if info.is_mac():
            self.assertTrue(info.total_bytes_memory() > 0)
        else:
            self.assertEquals(info.total_bytes_memory(), None)
    def test_real_code(self):
        # This test makes sure the real (unmocked) code actually works.
        info = PlatformInfo(sys, platform, 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_mac():
            self.assertTrue(info.total_bytes_memory() > 0)
        else:
            self.assertIsNone(info.total_bytes_memory())
 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())
Esempio n. 4
0
 def __init__(self, platforminfo=None):
     # We cannot get the PlatformInfo object from a SystemHost because
     # User is part of SystemHost itself.
     self._platforminfo = platforminfo or PlatformInfo(
         sys, platform, Executive())