OpenAssetIO / OpenAssetIO/OpenAssetIO
Improve `apiComplianceSuite` callback checks
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 348
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
[fix]/[plan] It occurs to me, we don't test that the appropriate index (_idx) is given by the manager implementation in any of our batch method tests in apiComplianceSuite.
We should probably use Mocks instead of lambdas to properly assert calls, and extract the arguments from its call_args for further inspection.
Alternatively, we can make sure we use the idx argument for implicit testing, e.g. errors = [None] then lambda idx, error: operators.setitem(errors, idx, error). But that has the disadvantage that we can't assert that the callback was only called once.
As a side note, adding an equality operator to BatchElementError would make testing easier, especially for the likes of assert_called_once_with, assert_has_calls, etc.
Originally posted by @feltech in https://github.com/OpenAssetIO/OpenAssetIO/pull/597#discussion_r959804024
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The work is in the apiComplianceSuite batch method tests; start by reviewing how callbacks are currently supplied and how BatchElementError is represented. Update the tests to inspect the callback index and verify callback call counts, then run the relevant batch method tests to confirm the expected errors and calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100