Skip to content

Add tests for using the mock as a decorator - #3450

Open
adamtheturtle wants to merge 1 commit into
mainfrom
adamtheturtle/mock-decorator-tests
Open

Add tests for using the mock as a decorator#3450
adamtheturtle wants to merge 1 commit into
mainfrom
adamtheturtle/mock-decorator-tests

Conversation

@adamtheturtle

Copy link
Copy Markdown
Member

MockVWS is a ContextDecorator, but every existing test used it only as a context manager. This adds a TestDecorator class to tests/mock_vws/test_requests_mock_usage.py covering decorator usage: requests and httpx requests are mocked inside the decorated function and unmocked after it returns, arguments and return values pass through, the function's name and docstring are preserved, databases and options (such as processing_time_seconds) given to the mock instance apply inside, targets persist across repeated calls of the same decorated function, a full add-then-query flow works, and methods can be decorated.

The tests live in an existing test module rather than a new file because CI shards tests by an explicit ci_pattern matrix whose entry count matches the number of per-job credential files in secrets.tar.gpg.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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