MCPcopy
hub / github.com/httpie/cli / test_daemon_runner

Function test_daemon_runner

tests/test_update_warnings.py:34–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32
33@pytest.mark.requires_external_processes
34def test_daemon_runner():
35 # We have a pseudo daemon task called 'check_status'
36 # which creates a temp file called STATUS_FILE under
37 # user's temp directory. This test simply ensures that
38 # we create a daemon that successfully performs the
39 # external task.
40
41 status_file = Path(tempfile.gettempdir()) / STATUS_FILE
42 with suppress(FileNotFoundError):
43 status_file.unlink()
44
45 spawn_daemon('check_status')
46
47 for attempt in range(MAX_ATTEMPT):
48 time.sleep(MAX_TIMEOUT / MAX_ATTEMPT)
49 if status_file.exists():
50 break
51 else:
52 pytest.fail(
53 'Maximum number of attempts failed for daemon status check.'
54 )
55
56 assert status_file.exists()
57
58
59def test_fetch(static_fetch_data, without_warnings):

Callers

nothing calls this directly

Calls 4

spawn_daemonFunction · 0.90
PathClass · 0.85
existsMethod · 0.80
failMethod · 0.80

Tested by

no test coverage detected