Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix regression with import packaging for branch coverage (#25070) #25074

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
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
9 changes: 7 additions & 2 deletions 9 python_files/unittestadapter/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from types import TracebackType
from typing import Dict, List, Optional, Set, Tuple, Type, Union

from packaging.version import Version

# Adds the scripts directory to the PATH as a workaround for enabling shell for test execution.
path_var_name = "PATH" if "PATH" in os.environ else "Path"
os.environ[path_var_name] = (
Expand Down Expand Up @@ -326,6 +324,13 @@ def send_run_data(raw_data, test_run_pipe):
)
import coverage

# insert "python_files/lib/python" into the path so packaging can be imported
python_files_dir = pathlib.Path(__file__).parent.parent
bundled_dir = pathlib.Path(python_files_dir / "lib" / "python")
sys.path.append(os.fspath(bundled_dir))

from packaging.version import Version

coverage_version = Version(coverage.__version__)
# only include branches if coverage version is 7.7.0 or greater (as this was when the api saves)
if coverage_version >= Version("7.7.0"):
Expand Down
8 changes: 7 additions & 1 deletion 8 python_files/vscode_pytest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from typing import TYPE_CHECKING, Any, Dict, Generator, Literal, TypedDict

import pytest
from packaging.version import Version

if TYPE_CHECKING:
from pluggy import Result
Expand Down Expand Up @@ -443,6 +442,13 @@ def pytest_sessionfinish(session, exitstatus):
# load the report and build the json result to return
import coverage

# insert "python_files/lib/python" into the path so packaging can be imported
python_files_dir = pathlib.Path(__file__).parent.parent
bundled_dir = pathlib.Path(python_files_dir / "lib" / "python")
sys.path.append(os.fspath(bundled_dir))

from packaging.version import Version

coverage_version = Version(coverage.__version__)
global INCLUDE_BRANCHES
# only include branches if coverage version is 7.7.0 or greater (as this was when the api saves)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.