Skip to content

Commit e096196

Browse files
committed
fix ruff
1 parent 0ea69c6 commit e096196

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

python_files/unittestadapter/execution.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import unittest
1212
from types import TracebackType
1313
from typing import Dict, List, Optional, Set, Tuple, Type, Union
14-
from packaging.version import Version
1514

15+
from packaging.version import Version
1616

1717
# Adds the scripts directory to the PATH as a workaround for enabling shell for test execution.
1818
path_var_name = "PATH" if "PATH" in os.environ else "Path"
@@ -325,20 +325,22 @@ def send_run_data(raw_data, test_run_pipe):
325325
workspace_root,
326326
)
327327
import coverage
328+
328329
coverage_version = Version(coverage.__version__)
329330
# only include branches if coverage version is 7.7.0 or greater (as this was when the api saves)
330331
if coverage_version >= Version("7.7.0"):
331332
include_branches = True
332333

333-
334334
source_ar: List[str] = []
335335
if workspace_root:
336336
source_ar.append(workspace_root)
337337
if top_level_dir:
338338
source_ar.append(top_level_dir)
339339
if start_dir:
340340
source_ar.append(os.path.abspath(start_dir)) # noqa: PTH100
341-
cov = coverage.Coverage(branch=include_branches, source=source_ar) # is at least 1 of these required??
341+
cov = coverage.Coverage(
342+
branch=include_branches, source=source_ar
343+
) # is at least 1 of these required??
342344
cov.start()
343345

344346
# If no error occurred, we will have test ids to run.

python_files/vscode_pytest/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
import sys
1212
import traceback
1313
from typing import TYPE_CHECKING, Any, Dict, Generator, Literal, TypedDict
14-
from packaging.version import Version
1514

1615
import pytest
16+
from packaging.version import Version
1717

1818
if TYPE_CHECKING:
1919
from pluggy import Result
@@ -479,8 +479,12 @@ def pytest_sessionfinish(session, exitstatus):
479479

480480
if INCLUDE_BRANCHES:
481481
branch_stats: dict[int, tuple[int, int]] = cov.branch_stats(file)
482-
total_file_branches = sum([total_exits for total_exits, _ in branch_stats.values()])
483-
taken_file_branches = sum([taken_exits for _, taken_exits in branch_stats.values()])
482+
total_file_branches = sum(
483+
[total_exits for total_exits, _ in branch_stats.values()]
484+
)
485+
taken_file_branches = sum(
486+
[taken_exits for _, taken_exits in branch_stats.values()]
487+
)
484488

485489
except NoSource:
486490
# as per issue 24308 this best way to handle this edge case

0 commit comments

Comments
 (0)