예제 #1
0
def test_is_detach_necessary_pid1(monkeypatch):
    def mock_os_getpid_1():
        return 1

    monkeypatch.setattr(os, 'getpid', mock_os_getpid_1)

    assert not Daemon._is_detach_necessary()
예제 #2
0
def test_is_detach_necessary_ppid1(monkeypatch):
    def mock_os_getppid_1():
        return 1

    monkeypatch.setattr(os, 'getppid', mock_os_getppid_1)

    # FIXME: This isn't really how I would prefer to test this,
    # but this is a difficult thing to test.
    assert Daemon._is_detach_necessary() == Daemon._is_in_container()