Skip to content

Skip context check for our tests #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions codeflash/discovery/functions_to_optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from codeflash.telemetry.posthog_cf import ph

if TYPE_CHECKING:
from argparse import Namespace

from libcst import CSTNode
from libcst.metadata import CodeRange

Expand Down Expand Up @@ -423,7 +425,7 @@ def inspect_top_level_functions_or_methods(


def was_function_previously_optimized(
function_to_optimize: FunctionToOptimize, code_context: CodeOptimizationContext
function_to_optimize: FunctionToOptimize, code_context: CodeOptimizationContext, args: Namespace
) -> bool:
"""Check which functions have already been optimized and filter them out.

Expand All @@ -445,7 +447,7 @@ def was_function_previously_optimized(
owner, repo = None, None
pr_number = get_pr_number()

if not owner or not repo or pr_number is None:
if not owner or not repo or pr_number is None or getattr(args, "no_pr", False):
return False

code_contexts = []
Expand Down
2 changes: 1 addition & 1 deletion codeflash/optimization/function_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def can_be_optimized(self) -> Result[tuple[bool, CodeOptimizationContext, dict[P
# last time we could not find an optimization, maybe this time we do.
# Random is before as a performance optimization, swapping the two 'and' statements has the same effect
if random.random() > REPEAT_OPTIMIZATION_PROBABILITY and was_function_previously_optimized( # noqa: S311
self.function_to_optimize, code_context
self.function_to_optimize, code_context, self.args
):
return Failure("Function optimization previously attempted, skipping.")

Expand Down
Loading