Skip to content

test: add pytest test suite for Python client library - #14

Open
EclipseWraith wants to merge 1 commit into
nsb-ucsc:mainfrom
EclipseWraith:feat/pytest-tests
Open

EclipseWraith wants to merge 1 commit into
nsb-ucsc:mainfrom
EclipseWraith:feat/pytest-tests

Conversation

@EclipseWraith

Copy link
Copy Markdown

Summary

Added a proper pytest-based test suite for the NSB Python client library.
The existing tests.py has several tests commented out due to API changes
(the code was refactored from raw protobuf objects to MessageEntry).
This new test file uses the current API and follows pytest conventions.

What's tested

Unit tests (9 tests, no external services needed):

  • MessageEntry: creation, auto-computed payload size, empty/large payloads
  • DBConnector: unique ID generation, client name in IDs, thread safety
  • Comms.Channels: enum values and count

Integration tests (3 tests, need Redis on port 5050):

  • RedisConnector: store/peek, store/checkout, binary data roundtrip

Running the tests

# Unit tests only
pytest test_nsb_client.py -v -m "not integration"

# All tests (Redis must be running on port 5050)
pytest test_nsb_client.py -v

Verification

All 12 tests pass on Ubuntu 24.04 (WSL) with Python 3.12.3 and pytest 9.0.2.

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.

1 participant