[FIX] Extract the required module names inside the read-writable context (CF-862)#935
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
…-global-definitions-deps
…h-ai/codeflash into fix/ctx-global-definitions-deps
|
|
||
| # In this scenario, the testgen code context is too long, so we abort. | ||
| with pytest.raises(ValueError, match="Testgen code context has exceeded token limit, cannot proceed"): | ||
| # In this scenario, the read-writable code context is too long because the __init_ function is reftencing the global x variable not the class attribute (x), so we abort. |
⚡️ Codeflash found optimizations for this PR📄 15% (0.15x) speedup for
|
|
@mohammedahmed18 wait where did you get the codeflash optimization? |
|
@aseembits93 from the extension by the git commit hook |
|
@mohammedahmed18 maybe we should add some identifier so we know when the optimizations are done via the VSC extension? |
this resolves two main issues:
1- the global definitions are not extracted inside the read-writable code context resulting frequently into mock variables when generating the tests which led to a failed optimization
2- when deciding for each function dependencies we conflict the class attributes with module-level variables if they have the same name, for example
it will say that MY_CLASS depends on the global definition
xwhich is not correct