Is it possible to only mock one command and run the rest with MockContext?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start with the MockContext entry point and inspect the surrounding test coverage. Determine whether a context can selectively mock commands while allowing others to execute, then define the behavior and tests needed for a supported solution.
Written by the indexing model from the issue text.
Description
I have some integration tests where I do want to run some commands, but mock out the others.
Obviously I can just factor the code in a way that would let me monkey patch some functions but I'm curious if MockContext has supports this ootb.
For example, I can't do something like this can I? Or can I extend MockContext with this functionality somehow?
ctx = MockContext(
run={
"my cmd 1": Result(stdout="mock output"),
"my cmd 3": Result(stdout="mock output"),
},
# Run the cmd for real in this block
actually_run={
"my cmd 2": Result(stdout="mock output"),
}
)
- Dominant language
- Python
- Stars
- 4.8k
- Forks
- 412
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
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.
More from pyinvoke/invoke
-
[Security] Shell injection via Context.cd() path argument — metacharacters not escaped (CWE-78) Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/skills#1811 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
speaches-ai/speaches#678 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
datalayer/mcp-compose#42 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
UKGovernmentBEIS/inspect_evals#2523 ·