FastLED
3.10.8
Loading...
Searching...
No Matches
test_quick.py
Go to the documentation of this file.
1
import
os
2
import
sys
3
import
time
4
5
import
httpx
6
from
running_process
import
STDOUT, RunningProcess
7
8
9
# Get absolute paths
10
cwd = os.getcwd()
11
runner_path = os.path.join(
12
cwd,
".build"
,
"meson-quick"
,
"examples"
,
"example_runner.exe"
13
)
14
dll_path = os.path.join(cwd,
".build"
,
"meson-quick"
,
"examples"
,
"example-Server.dll"
)
15
16
print
(f
"Starting server..."
)
17
print
(f
" Runner: {runner_path}"
)
18
print
(f
" DLL: {dll_path}"
)
19
20
# Start server in background
21
proc = RunningProcess(
22
[runner_path, dll_path],
23
auto_run=
True
,
24
capture=
True
,
25
stderr=STDOUT,
26
encoding=
"utf-8"
,
27
errors=
"replace"
,
28
)
29
30
# Wait for server to start
31
time.sleep(1.5)
32
33
# Try to connect
34
try
:
35
print
(
"\nTesting GET /"
)
36
response = httpx.get(
"http://localhost:8080/"
, timeout=5.0)
37
print
(f
"✓ Status: {response.status_code}"
)
38
print
(f
" Response: {response.text!r}\n"
)
39
40
print
(
"Testing GET /ping"
)
41
response = httpx.get(
"http://localhost:8080/ping"
, timeout=5.0)
42
print
(f
"✓ Status: {response.status_code}"
)
43
print
(f
" Response: {response.text!r}\n"
)
44
45
print
(
"Testing GET /status"
)
46
response = httpx.get(
"http://localhost:8080/status"
, timeout=5.0)
47
print
(f
"✓ Status: {response.status_code}"
)
48
print
(f
" Response (JSON): {response.json()}\n"
)
49
50
print
(
"✓ All tests passed!"
)
51
sys.exit(0)
52
except
Exception
as
e:
53
print
(f
"\n✗ Error: {e}"
)
54
# Print server output for debugging
55
proc.terminate()
56
try
:
57
proc.wait(timeout=1)
58
except
TimeoutError:
59
pass
60
print
(f
"\nServer output:\n{proc.stdout}"
)
61
sys.exit(1)
62
finally
:
63
proc.terminate()
64
try
:
65
proc.wait(timeout=1)
66
except
:
67
proc.kill()
print
Serial print("Error: ")
examples
Asio
Server
test_quick.py
Generated on Sun Oct 18 2026 00:56:49 for FastLED by
1.13.2