Skip to content

Commit 1db3693

Browse files
committed
cleanup
1 parent 7b06b22 commit 1db3693

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

.github/instructions/python-quality-checks.instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ npm run check-python:pyright
5252

5353
## Configuration
5454

55-
- **Ruff**: Line length 100, Python 3.8+, 40+ rule families (flake8, isort, pyupgrade, etc.)
56-
- **Pyright**: Version 1.1.308 (pinned), ignores `lib/` and 15+ legacy files
55+
- **Ruff**: Line length 100, Python 3.9+, 40+ rule families (flake8, isort, pyupgrade, etc.)
56+
- **Pyright**: Version 1.1.308 (or whatever is found in the environment), ignores `lib/` and 15+ legacy files
5757
- Config: `python_files/pyproject.toml` sections `[tool.ruff]` and `[tool.pyright]`
5858

5959
## Troubleshooting

python_files/vscode_pytest/__init__.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def pytest_sessionfinish(session, exitstatus):
531531

532532
def construct_nested_folders(
533533
file_nodes_dict: dict[str, TestNode],
534-
session_node: TestNode, # session_node['path'] is a pathlib.Path object
534+
session_node: TestNode,
535535
session_children_dict: dict[str, TestNode],
536536
) -> dict[str, TestNode]:
537537
"""Iterate through all files and construct them into nested folders.
@@ -557,10 +557,6 @@ def construct_nested_folders(
557557
print(
558558
"[vscode-pytest]: Session path not a parent of test paths, adjusting session node to common parent."
559559
)
560-
# IMPORTANT: Use session_node["path"] directly as it's already a pathlib.Path object
561-
# Do NOT use get_node_path(session_node["path"]) as get_node_path expects pytest objects,
562-
# not Path objects directly.
563-
# Convert Path objects to strings for os.path.commonpath
564560
file_path_str: str = str(file_node["path"])
565561
session_path_str: str = str(session_node["path"])
566562
common_parent = os.path.commonpath([file_path_str, session_path_str])
@@ -582,15 +578,15 @@ def construct_nested_folders(
582578

583579

584580
def process_parameterized_test(
585-
test_case: pytest.Item, # Must have callspec attribute (parameterized test)
581+
test_case: pytest.Item,
586582
test_node: TestItem,
587583
function_nodes_dict: dict[str, TestNode],
588584
file_nodes_dict: dict[str, TestNode],
589585
) -> TestNode:
590586
"""Process a parameterized test case and create appropriate function nodes.
591587
592588
Keyword arguments:
593-
test_case -- the parameterized pytest test case
589+
test_case -- the parameterized pytest test case; must have callspec attribute
594590
test_node -- the test node created from the test case
595591
function_nodes_dict -- dictionary of function nodes indexed by ID
596592
file_nodes_dict -- dictionary of file nodes indexed by path
@@ -739,9 +735,9 @@ def build_test_tree(session: pytest.Session) -> TestNode:
739735

740736

741737
def build_nested_folders(
742-
file_node: TestNode, # A file node to build folders for
743-
created_files_folders_dict: dict[str, TestNode], # Cache of created folders indexed by path
744-
session_node: TestNode, # The session node containing path information
738+
file_node: TestNode,
739+
created_files_folders_dict: dict[str, TestNode],
740+
session_node: TestNode,
745741
) -> TestNode:
746742
"""Takes a file or folder and builds the nested folder structure for it.
747743

0 commit comments

Comments
 (0)