MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / test_csv_export_basic

Function test_csv_export_basic

tests/integration/test_csv_export.py:20–54  ·  view source on GitHub ↗

Test basic CSV export functionality.

(api_client, device_simulator, clean_state, temp_dir)

Source from the content-addressed store, hash-verified

18
19@pytest.mark.csv
20def test_csv_export_basic(api_client, device_simulator, clean_state, temp_dir):
21 """Test basic CSV export functionality."""
22 api_client.configure_network(host="127.0.0.1", port=9000, socket_type="tcp")
23
24 # Enable CSV export before connecting
25 api_client.enable_csv_export()
26 time.sleep(0.5)
27
28 export_status = api_client.get_csv_export_status()
29 assert export_status["enabled"], "CSV export should be enabled"
30
31 # Connect and start sending data
32 api_client.connect_device()
33 assert device_simulator.wait_for_connection(timeout=5.0)
34
35 # Send some frames first - CSV file opens when data flows
36 frames = DataGenerator.generate_realistic_telemetry(
37 duration_seconds=2.0,
38 frequency_hz=10.0,
39 frame_format="json",
40 checksum_type=ChecksumType.CRC16,
41 )
42
43 device_simulator.send_frames(frames, interval_seconds=0.1)
44 time.sleep(2.5)
45
46 # Now CSV file should be open (data has been written)
47 export_status = api_client.get_csv_export_status()
48 # Note: isOpen might be False if file is opened/closed per write
49 # Just verify export is still enabled
50 assert export_status["enabled"], "CSV export should still be enabled"
51
52 api_client.disconnect_device()
53 api_client.disable_csv_export()
54 time.sleep(0.5)
55
56
57@pytest.mark.csv

Callers

nothing calls this directly

Calls 9

configure_networkMethod · 0.80
enable_csv_exportMethod · 0.80
get_csv_export_statusMethod · 0.80
connect_deviceMethod · 0.80
send_framesMethod · 0.80
disconnect_deviceMethod · 0.80
disable_csv_exportMethod · 0.80
wait_for_connectionMethod · 0.45

Tested by

no test coverage detected