Replies: 2 comments
|
Sounds good, and what about formatting rules for tests? |
0 replies
|
Hey, I’ll push the formatting rules along with the PR. Sorry for the delay, got caught up with something recently. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Testing Standard
I think
unittestshould not be used as the primary testing framework for this repository. The onlyunittestAPIs that should remain common are the mocking helpers inunittest.mocksuch aspatch,MagicMock, andAsyncMock.Why
pytestpytesteverywhere intests/,observal-server/tests/, andobserval_cli/tests/.pytestandpytest-asyncio, so async tests fit the repo without extra boilerplate.pytestgives consistent fixtures, parametrization, and clearer assertions for the mix of API, CLI, service, and integration tests in Observal.Where
unitteststill fitsunittest.mockwhen it is the most direct way to isolate a dependency.unittest.TestCase-based test suites unless a third-party dependency forces that structure.pyteststyle afterward.Template Example
Use this as the default shape for new test files.
File Structure
Style Rules
assertstatements over framework-specific assertion helpers.parametrizewhen the same behavior should be checked across multiple inputs.pytest.mark.asynciofor async tests.Running Tests
Decision
For Observal, the standard test framework is
pytest.unittestis only acceptable as a support library throughunittest.mock, not as the default style for new tests.All reactions