Skip to content
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
4 changes: 3 additions & 1 deletion tests/test_completion/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

from docs_src.commands.index import tutorial001 as mod

from ..utils import needs_linux
from ..utils import needs_bash, needs_linux


@needs_bash
@needs_linux
def test_show_completion():
result = subprocess.run(
Expand All @@ -23,6 +24,7 @@ def test_show_completion():
assert "_TUTORIAL001.PY_COMPLETE=complete_bash" in result.stdout


@needs_bash
@needs_linux
def test_install_completion():
bash_completion_path: Path = Path.home() / ".bashrc"
Expand Down
16 changes: 16 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,26 @@

import pytest

try:
import shellingham
from shellingham import ShellDetectionFailure

shell = shellingham.detect_shell()[0]
except ImportError: # pragma: no cover
shellingham = None
shell = None
except ShellDetectionFailure: # pragma: no cover
shell = None


needs_py310 = pytest.mark.skipif(
sys.version_info < (3, 10), reason="requires python3.10+"
)

needs_linux = pytest.mark.skipif(
not sys.platform.startswith("linux"), reason="Test requires Linux"
)

needs_bash = pytest.mark.skipif(
not shellingham or not shell or "bash" not in shell, reason="Test requires Bash"
)
Loading