Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def test_async_alive_terminates(mocker):
mock_start_process = mocker.patch('watchgod.main._start_process')
mock_start_process.return_value = FakeProcess()
mock_kill = mocker.patch('watchgod.main.os.kill')
f = Future()
f.set_result(1)
c = mocker.MagicMock(return_value=f)
reloads = await arun_process('/x/y/async', object(), watcher_cls=FakeWatcher, callback=c, debounce=5, min_sleep=1)
assert reloads == 1
assert mock_start_process.call_count == 2
assert mock_kill.call_count == 1
assert c.call_count == 1
c.assert_called_with({'x'})