Repository navigation
Rewrite unittest.mock usage to flexmock - #818
Conversation
|
there are some findings from the Codex: |
|
Could we also add a mention to CONTRIBUTING.md or somewhere that flexmock is the preferred mocking framework, so we don't have to repeat this in the future? |
043d129 to
7e8a485
Compare
opohorel
left a comment
There was a problem hiding this comment.
LGTM, thanks for looking into this!
nforro
left a comment
There was a problem hiding this comment.
There seem to be some issues:
-
Medium:
test_reproducer_lock.py:102-115
flexmock().should_receive("__call__")does not intercept calls. Both tests pass for the wrong reason, leaving the skip and fallback behavior unverified. -
Medium:
test_reproducer_agent.py:854
fake_workflow()accepts no arguments, but production supplies several. The resultingTypeErroris caught and retried, so this happy-path test instead exercises failure handling. -
Medium:
test_mr_consolidation.py:348
The.never()expectation is installed after execution and also targets an unsupported bare__call__. It cannot detect an erroneous completion call. -
Low:
test_triage_agent.py:622
The replacement for synchronousget_mock_local_tool_env()is async. Production receives a truthy coroutine rather thanNone, changing the tested path and potentially emitting an unawaited-coroutine warning. -
Low:
test_tasks.py:265
mock_jira_comment()accepts no arguments. The test catches an argument-bindingTypeError, not the intended JiraRuntimeError. -
Low:
test_main.py:485-508
Replacingos.environwith{}makes the environment-preservation assertions vacuously pass, so existing mock Jira values are no longer tested.
7e8a485 to
4a6dacb
Compare
|
/agentic_review |
4a6dacb to
6446179
Compare
|
/agentic_review |
Code Review by Qodo
1.
|
497e3eb to
6713f56
Compare
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 6713f56 |
6713f56 to
da1609a
Compare
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit da1609a |
da1609a to
eda6c36
Compare
|
@opohorel yeah no problem, it's just that this probably needs your another review :D at least the 3 new test modules: |
opohorel
left a comment
There was a problem hiding this comment.
IMO this is good to merge
Move out import statements from inside functions. Mention flexmock preferral in CONTRIBUTING.md. Unify helper mock function naming across affected modules. Signed-off-by: Jan Matufka <jmatufka@redhat.com>
f57dac1 to
0828c29
Compare
test_zstream_search.pyhelper functionAFTER REVIEWS:
CONTRIBUTING.md_mock_*()