Skip to content

Commit dcd7ffa

Browse files
committed
reduce comments
1 parent 45117c4 commit dcd7ffa

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

python_files/vscode_pytest/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(self, message):
8383
# Performance optimization caches for path resolution
8484
_path_cache: dict[int, pathlib.Path] = {} # Cache node paths by object id
8585
_path_to_str_cache: dict[pathlib.Path, str] = {} # Cache path-to-string conversions
86-
_CACHED_CWD: pathlib.Path | None = None # Cache cwd once instead of thousands of calls
86+
_CACHED_CWD: pathlib.Path | None = None
8787

8888

8989
def pytest_load_initial_conftests(early_config, parser, args): # noqa: ARG001
@@ -636,7 +636,6 @@ def process_parameterized_test(
636636
"Unable to find original name for parameterized test case"
637637
) from None
638638

639-
# Use dict.get() instead of exception-based control flow
640639
function_test_node = function_nodes_dict.get(parent_id)
641640
if function_test_node is None:
642641
function_test_node = create_parameterized_function_node(
@@ -700,7 +699,6 @@ def build_test_tree(session: pytest.Session) -> TestNode:
700699
USES_PYTEST_DESCRIBE and isinstance(case_iter, DescribeBlock)
701700
):
702701
# While the given node is a class, create a class and nest the previous node as a child.
703-
# Use dict.get() instead of exception-based control flow
704702
test_class_node = class_nodes_dict.get(case_iter.nodeid)
705703
if test_class_node is None:
706704
test_class_node = create_class_node(case_iter)
@@ -953,8 +951,7 @@ def cached_fsdecode(path: pathlib.Path) -> str:
953951
"""Convert path to string with caching for performance.
954952
955953
This function caches path-to-string conversions to avoid redundant
956-
os.fsdecode() calls during test tree building. For large test suites,
957-
this can save millions of string conversion operations.
954+
os.fsdecode() calls during test tree building.
958955
959956
Parameters:
960957
path: The pathlib.Path object to convert to string.
@@ -978,7 +975,6 @@ def get_node_path(
978975
"""A function that returns the path of a node given the switch to pathlib.Path.
979976
980977
It also evaluates if the node is a symlink and returns the equivalent path.
981-
This function uses caching to avoid redundant path resolution operations.
982978
983979
Parameters:
984980
node: A pytest object or any object that has a path or fspath attribute.
@@ -987,7 +983,6 @@ def get_node_path(
987983
Returns:
988984
pathlib.Path: The resolved path for the node.
989985
"""
990-
# Use object id as cache key for O(1) lookups
991986
cache_key = id(node)
992987
if cache_key in _path_cache:
993988
return _path_cache[cache_key]

0 commit comments

Comments
 (0)