Skip to content

Add unit tests for untested modules#1185

Merged
ruck314 merged 3 commits intopre-releasefrom
adding-more-unit-tests
Apr 17, 2026
Merged

Add unit tests for untested modules#1185
ruck314 merged 3 commits intopre-releasefrom
adding-more-unit-tests

Conversation

@ruck314
Copy link
Copy Markdown
Contributor

@ruck314 ruck314 commented Apr 15, 2026

Summary

  • Add 17 new test files (1,773 lines) covering remaining modules without unit tests
  • 82 new test cases pass, 5 skip gracefully (GPIB library, ZMQ client GIL constraint)
  • C++ CRC test via doctest (header-only CRC.h check vectors)

Modules now covered

Protocols: SrpV0, SRP Cmd, Packetizer CRC (C++), Packetizer V1 Core, RSSI Client+Server, GPIB (conditional)
Utilities: PRBS generator/checker, PrbsRx/PrbsTx/PrbsPair devices, HLS RegInterfParser
Interfaces: Stream TCP bridge, Stream Fifo device, Stream Variable, ZmqClient (skipped), AxiStreamDmaMon (mock), hardware module imports
PyDM: Smoke-import all 18 tools/widgets (conditional skip when Qt unavailable)

Test plan

  • ./scripts/run_linters.sh clean (flake8 on new files)
  • cmake -S . -B build -DROGUE_INSTALL=local -DROGUE_BUILD_TESTS=ON && cmake --build build -j && cmake --build build --target install
  • ctest --test-dir build --output-on-failure -L cpp
  • python -m pytest <new test files> -v
  • python -m pytest -m "not perf" --ignore=tests/perf

Note

  • XVC tests excluded per PR XVC: event-driven refactor + CI regression test #1182
  • ZmqClient tests are written but skipped: the C++ ZmqClient deadlocks with an in-process Python ZmqServer under pytest's GIL constraints (works standalone). The Python ZMQ server is already covered by test_interfaces_zmq_server.py.

@ruck314 ruck314 force-pushed the adding-more-unit-tests branch 2 times, most recently from 9ccd37c to 61bdd7a Compare April 15, 2026 14:58
@ruck314 ruck314 requested a review from Copilot April 15, 2026 15:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a broad set of new unit/integration tests to close previously identified coverage gaps across protocols, utilities, interfaces, PyDM imports, and C++ packetizer CRC functionality.

Changes:

  • Add new pytest-based tests for SRP (v0 + Cmd), PRBS utilities/devices, stream interfaces (FIFO device, stream variable), TCP bridge, RSSI, Packetizer V1, HLS RegInterfParser, and conditional smoke imports (GPIB / hardware / PyDM).
  • Add new C++ doctest coverage for rogue/protocols/packetizer/CRC.h and wire it into the CMake test build.
  • Extend tests/cpp CMake structure to include the new protocols/packetizer test directory.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/utilities/test_reg_interf_parser.py Tests HLS RegInterfParser parsing and error exits using temp zip/header inputs.
tests/utilities/test_prbs_devices.py Exercises PyRogue PRBS device trees and basic loopback behavior.
tests/utilities/test_prbs.py Tests rogue.utilities.Prbs generation/checking, widths, counters, and enable/disable API.
tests/protocols/test_srpv0.py Adds SRPv0 end-to-end tests using a Python responder to emulate hardware.
tests/protocols/test_srp_cmd.py Validates SRP Cmd frame size and content.
tests/protocols/test_gpib.py Conditional import/skip smoke tests for optional GPIB dependencies.
tests/interfaces/test_zmq_client.py Adds (currently skipped) ZmqClient API tests and a local ZmqServer setup helper.
tests/interfaces/test_stream_variable.py Tests YAML streaming behavior of pyrogue.interfaces.stream.Variable.
tests/interfaces/test_stream_fifo_device.py Tests PyRogue stream Fifo device variables and stream flow.
tests/interfaces/test_pydm_tools_widgets_smoke.py Conditional import smoke tests for PyDM/Qt tools/widgets.
tests/interfaces/test_hardware_imports.py Conditional import smoke tests for rogue.hardware on supported platforms.
tests/interfaces/test_axi_stream_dma_mon.py Tests DMA monitor device variables using a mock DMA object (conditional import).
tests/integration/test_stream_tcp_bridge.py Adds integration tests for TcpServer/TcpClient frame delivery and ordering.
tests/integration/test_rssi_loopback.py Adds RSSI handshake/data transfer/invariants integration checks over UDP.
tests/integration/test_packetizer_v1.py Adds integration tests for packetizer v1 routing and fragmentation.
tests/cpp/protocols/packetizer/test_crc.cpp Adds doctest coverage for CRC check vectors and incremental/table modes.
tests/cpp/protocols/packetizer/CMakeLists.txt Registers the new CRC C++ test target.
tests/cpp/protocols/CMakeLists.txt Adds protocols subtree to C++ tests.
tests/cpp/CMakeLists.txt Includes protocols subtree in overall C++ test build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/interfaces/test_zmq_client.py Outdated
Comment thread tests/protocols/test_srpv0.py Outdated
Comment thread tests/integration/test_stream_tcp_bridge.py
Comment thread tests/interfaces/test_zmq_client.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/conftest.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Add comprehensive test coverage for protocols (GPIB, SRP, Packetizer,
RSSI), interfaces (ZMQ, PyDM, StreamFifo, AxiStreamDma, StreamVariable),
utilities (PRBS, register interface parser), and integration tests
(TCP bridge, Packetizer v1). Includes C++ CRC unit test, improved
conftest fixtures for port isolation, and test hardening for CI.
@ruck314 ruck314 force-pushed the adding-more-unit-tests branch from 02daab3 to d314717 Compare April 15, 2026 16:11
@ruck314 ruck314 requested a review from bengineerd April 15, 2026 16:12
@ruck314 ruck314 marked this pull request as ready for review April 15, 2026 16:12
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.97%. Comparing base (b1e9040) to head (6cc49cf).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@               Coverage Diff               @@
##           pre-release    #1185      +/-   ##
===============================================
+ Coverage        56.05%   58.97%   +2.92%     
===============================================
  Files               70       72       +2     
  Lines             8137     8168      +31     
  Branches          1209     1209              
===============================================
+ Hits              4561     4817     +256     
+ Misses            3293     3059     -234     
- Partials           283      292       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ruck314 ruck314 merged commit 7b43b64 into pre-release Apr 17, 2026
7 checks passed
@ruck314 ruck314 deleted the adding-more-unit-tests branch April 17, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants