Skip to content

Commit

Permalink
d updated markdown snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 28, 2024
1 parent 33df80f commit a387954
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions approvaltests/namer/stack_frame_namer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def is_pytest_test(frame: FrameInfo) -> bool:
method_name = frame[3]
patterns = PytestConfig.test_naming_patterns
return StackFrameNamer._is_match_for_pytest(method_name, patterns)

@staticmethod
def _is_match_for_pytest(method_name: str, patterns: List[str]) -> bool:
# Do not modify this method, so we can compare with original code
Expand All @@ -57,12 +58,12 @@ def _is_match_for_pytest(method_name: str, patterns: List[str]) -> bool:
# because this is called for every name in each collected module,
# and fnmatch is somewhat expensive to call.
elif (
"*" in pattern or "?" in pattern or "[" in pattern
"*" in pattern or "?" in pattern or "[" in pattern
) and fnmatch.fnmatch(method_name, pattern):
return True

return False

@staticmethod
def is_unittest_test(frame: FrameInfo) -> bool:
method_name = frame[3]
Expand Down Expand Up @@ -110,5 +111,3 @@ def get_test_frame(cls) -> FrameInfo:
calling_stack = inspect.stack(1)
frame = StackFrameNamer.get_test_frame_index(calling_stack)
return calling_stack[frame]


0 comments on commit a387954

Please sign in to comment.