Skip to content

Commit

Permalink
Skip tcsh tests on broken tcsh versions (#2817)
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <[email protected]>
  • Loading branch information
gaborbernat authored Jan 3, 2025
1 parent baf2da4 commit eb8c7c3
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
hooks:
- id: pyproject-fmt
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.3"
rev: "v0.8.5"
hooks:
- id: ruff-format
- id: ruff
Expand Down
1 change: 1 addition & 0 deletions docs/changelog/2814.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Skip tcsh tests on broken tcsh versions - by :user:`gaborbernat`.
4 changes: 2 additions & 2 deletions src/virtualenv/discovery/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
from contextlib import suppress
from pathlib import Path
from typing import TYPE_CHECKING, Callable
from typing import TYPE_CHECKING

from virtualenv.info import IS_WIN, fs_path_id

Expand All @@ -15,7 +15,7 @@

if TYPE_CHECKING:
from argparse import ArgumentParser
from collections.abc import Generator, Iterable, Mapping, Sequence
from collections.abc import Callable, Generator, Iterable, Mapping, Sequence

from virtualenv.app_data.base import AppData
LOGGER = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/activation/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __call__(self, monkeypatch, tmp_path):
try:
process = Popen(invoke, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env)
raw_, _ = process.communicate()
raw = raw_.decode()
raw = raw_.decode(errors="replace")
assert process.returncode == 0, raw
except subprocess.CalledProcessError as exception:
output = exception.output + exception.stderr
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/activation/test_csh.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
from __future__ import annotations

import sys
from shutil import which
from subprocess import check_output

import pytest
from packaging.version import Version

from virtualenv.activation import CShellActivator


def test_csh(activation_tester_class, activation_tester):
exe = f"tcsh{'.exe' if sys.platform == 'win32' else ''}"
if which(exe):
version_text = check_output([exe, "--version"], text=True, encoding="utf-8")
version = Version(version_text.split(" ")[1])
if version >= Version("6.24.14"):
pytest.skip("https://github.com/tcsh-org/tcsh/issues/117")

class Csh(activation_tester_class):
def __init__(self, session) -> None:
super().__init__(CShellActivator, session, "csh", "activate.csh", "csh")
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/seed/wheels/test_acquire.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from datetime import datetime, timezone
from pathlib import Path
from subprocess import CalledProcessError
from typing import TYPE_CHECKING, Callable
from typing import TYPE_CHECKING

import pytest

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

if TYPE_CHECKING:
from collections.abc import Callable
from unittest.mock import MagicMock

from pytest_mock import MockerFixture
Expand Down

0 comments on commit eb8c7c3

Please sign in to comment.