Skip to content

Commit eb8c7c3

Browse files
authored
Skip tcsh tests on broken tcsh versions (#2817)
Signed-off-by: Bernát Gábor <[email protected]>
1 parent baf2da4 commit eb8c7c3

File tree

6 files changed

+21
-5
lines changed

6 files changed

+21
-5
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
hooks:
2525
- id: pyproject-fmt
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: "v0.8.3"
27+
rev: "v0.8.5"
2828
hooks:
2929
- id: ruff-format
3030
- id: ruff

docs/changelog/2814.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Skip tcsh tests on broken tcsh versions - by :user:`gaborbernat`.

src/virtualenv/discovery/builtin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sys
66
from contextlib import suppress
77
from pathlib import Path
8-
from typing import TYPE_CHECKING, Callable
8+
from typing import TYPE_CHECKING
99

1010
from virtualenv.info import IS_WIN, fs_path_id
1111

@@ -15,7 +15,7 @@
1515

1616
if TYPE_CHECKING:
1717
from argparse import ArgumentParser
18-
from collections.abc import Generator, Iterable, Mapping, Sequence
18+
from collections.abc import Callable, Generator, Iterable, Mapping, Sequence
1919

2020
from virtualenv.app_data.base import AppData
2121
LOGGER = logging.getLogger(__name__)

tests/unit/activation/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __call__(self, monkeypatch, tmp_path):
7777
try:
7878
process = Popen(invoke, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env)
7979
raw_, _ = process.communicate()
80-
raw = raw_.decode()
80+
raw = raw_.decode(errors="replace")
8181
assert process.returncode == 0, raw
8282
except subprocess.CalledProcessError as exception:
8383
output = exception.output + exception.stderr

tests/unit/activation/test_csh.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
from __future__ import annotations
22

3+
import sys
4+
from shutil import which
5+
from subprocess import check_output
6+
7+
import pytest
8+
from packaging.version import Version
9+
310
from virtualenv.activation import CShellActivator
411

512

613
def test_csh(activation_tester_class, activation_tester):
14+
exe = f"tcsh{'.exe' if sys.platform == 'win32' else ''}"
15+
if which(exe):
16+
version_text = check_output([exe, "--version"], text=True, encoding="utf-8")
17+
version = Version(version_text.split(" ")[1])
18+
if version >= Version("6.24.14"):
19+
pytest.skip("https://github.com/tcsh-org/tcsh/issues/117")
20+
721
class Csh(activation_tester_class):
822
def __init__(self, session) -> None:
923
super().__init__(CShellActivator, session, "csh", "activate.csh", "csh")

tests/unit/seed/wheels/test_acquire.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from datetime import datetime, timezone
66
from pathlib import Path
77
from subprocess import CalledProcessError
8-
from typing import TYPE_CHECKING, Callable
8+
from typing import TYPE_CHECKING
99

1010
import pytest
1111

@@ -16,6 +16,7 @@
1616
from virtualenv.seed.wheels.util import Wheel, discover_wheels
1717

1818
if TYPE_CHECKING:
19+
from collections.abc import Callable
1920
from unittest.mock import MagicMock
2021

2122
from pytest_mock import MockerFixture

0 commit comments

Comments
 (0)