Skip to content

Commit

Permalink
env: avoid warning on Windows 3.11.0
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii authored and FFY00 committed Oct 27, 2022
1 parent 3b36b6e commit a3700d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/build/env.py
Expand Up @@ -11,6 +11,7 @@
import sys
import sysconfig
import tempfile
import warnings

from types import TracebackType
from typing import Callable, Collection, List, Optional, Tuple, Type
Expand Down Expand Up @@ -262,7 +263,10 @@ def _create_isolated_env_venv(path: str) -> Tuple[str, str]:

symlinks = _fs_supports_symlink()
try:
venv.EnvBuilder(with_pip=True, symlinks=symlinks).create(path)
with warnings.catch_warnings():
if sys.version_info[:3] == (3, 11, 0):
warnings.filterwarnings('ignore', 'check_home argument is deprecated and ignored.', DeprecationWarning)
venv.EnvBuilder(with_pip=True, symlinks=symlinks).create(path)
except subprocess.CalledProcessError as exc:
raise build.FailedProcessError(exc, 'Failed to create venv. Maybe try installing virtualenv.') from None

Expand Down
4 changes: 2 additions & 2 deletions tests/test_env.py
Expand Up @@ -119,8 +119,8 @@ def test_isolated_env_log(mocker, caplog, package_test_flit):
if sys.version_info >= (3, 8): # stacklevel
assert [(record.lineno) for record in caplog.records] == [
frameinfo.lineno + 1,
frameinfo.lineno - 7,
frameinfo.lineno + 84,
frameinfo.lineno - 6,
frameinfo.lineno + 85,
]


Expand Down

0 comments on commit a3700d3

Please sign in to comment.