Skip to content
Myr

✅ Add `needs_bash` test fixture (#888)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sofie Van Landeghem · committed by GitHub · parent 6cc1f9a · Browse files · 2 files+19 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Diff stats

2 files+19 added−1 removed

  • tests:+19 added−1 removed

2 files+19 added−1 removed

modified:tests/test_completion/test_completion.py+3 added-1 removed
3 unmodified lines
4from pathlib import Path56from docs_src.commands.index import tutorial001 as mod78from ..utils import needs_linux8from ..utils import needs_bash, needs_linux91011@needs_bash12@needs_linux13def test_show_completion():14 result = subprocess.run(15 [
7 unmodified lines
23 )24 assert "_TUTORIAL001.PY_COMPLETE=complete_bash" in result.stdout252627@needs_bash28@needs_linux29def test_install_completion():30 bash_completion_path: Path = Path.home() / ".bashrc"31 text = ""
132 unmodified lines
modified:tests/utils.py+16 added
1import sys23import pytest45try:6 import shellingham7 from shellingham import ShellDetectionFailure89 shell = shellingham.detect_shell()[0]10except ImportError: # pragma: no cover11 shellingham = None12 shell = None13except ShellDetectionFailure: # pragma: no cover14 shell = None151617needs_py310 = pytest.mark.skipif(18 sys.version_info < (3, 10), reason="requires python3.10+"19)2021needs_linux = pytest.mark.skipif(22 not sys.platform.startswith("linux"), reason="Test requires Linux"23)2425needs_bash = pytest.mark.skipif(26 not shellingham or not shell or "bash" not in shell, reason="Test requires Bash"27)