예제 #1
0
 def test_singleton(self) -> None:
     """Test singleton."""
     assert id(OsInfo()) == id(OsInfo())
예제 #2
0
 def test_name_linux(self, platform_linux: None) -> None:
     """Test name linux."""
     assert OsInfo().name == "linux"
예제 #3
0
 def test_name_windows(self, platform_windows: None) -> None:
     """Test name windows."""
     assert OsInfo().name == "windows"
예제 #4
0
 def test_is_windows(self, platform_windows: None) -> None:
     """Test is_windows."""
     assert OsInfo().is_windows
예제 #5
0
 def test_name_darwin(self, platform_darwin: None) -> None:
     """Test name darwin."""
     assert OsInfo().name == "darwin"
예제 #6
0
 def test_is_posix(self, mocker: MockerFixture) -> None:
     """Test is_posix."""
     mock_os = mocker.patch(f"{MODULE}.os")
     mock_os.name = "posix"
     assert OsInfo().is_posix
예제 #7
0
 def test_is_windows_false(self, platform_linux: None) -> None:
     """Test is_windows False."""
     assert not OsInfo().is_windows
예제 #8
0
 def test_is_posix_false(self, mocker: MockerFixture) -> None:
     """Test is_posix False."""
     mock_os = mocker.patch(f"{MODULE}.os")
     mock_os.name = "nt"
     assert not OsInfo().is_posix
예제 #9
0
 def test_is_macos(self, platform_darwin: None) -> None:
     """Test is_macos."""
     assert OsInfo().is_macos
예제 #10
0
 def test_is_linux(self, platform_linux: None) -> None:
     """Test is_linux."""
     assert OsInfo().is_linux
예제 #11
0
 def test_is_linux_false(self, platform_darwin: None) -> None:
     """Test is_linux False."""
     assert not OsInfo().is_linux
예제 #12
0
def clear_OsInfo() -> None:  # noqa
    """Clear OsInfo singleton."""
    OsInfo.clear_singleton()