예제 #1
0
def test_set_pid_valid_path():
    daemon = Daemon('/fake/path.pid')
    m_open = mock.mock_open()
    with mock.patch('builtins.open', m_open, create=True):
        daemon.pid = 123
    m_open.assert_called_once_with('/fake/path.pid', 'w+')
예제 #2
0
def test_set_pid_invalid_path(_):
    daemon = Daemon('/fake/path.pid')
    with pytest.raises(DaemonException):
        daemon.pid = 123