2022-07-28 01:06:46 -07:00
|
|
|
# SPDX-FileCopyrightText: 2022 James R. Barlow
|
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
2019-07-02 13:49:17 -07:00
|
|
|
|
2022-07-23 00:39:24 -07:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
2021-04-06 01:15:00 -07:00
|
|
|
import os
|
2023-04-14 00:38:34 -07:00
|
|
|
from subprocess import run
|
2019-07-02 13:49:17 -07:00
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
2024-10-27 11:55:22 -07:00
|
|
|
from ocrmypdf.helpers import running_in_docker
|
2021-04-07 01:56:51 -07:00
|
|
|
|
2019-11-03 23:39:40 -08:00
|
|
|
pytestmark = pytest.mark.skipif(
|
2021-04-07 01:56:51 -07:00
|
|
|
running_in_docker(),
|
2019-11-03 23:39:40 -08:00
|
|
|
reason="docker can't complete",
|
|
|
|
|
)
|
|
|
|
|
|
2019-07-02 13:49:17 -07:00
|
|
|
|
|
|
|
|
def test_fish():
|
|
|
|
|
try:
|
|
|
|
|
proc = run(
|
|
|
|
|
['fish', '-n', 'misc/completion/ocrmypdf.fish'],
|
|
|
|
|
check=True,
|
|
|
|
|
encoding='utf-8',
|
2022-04-03 19:11:06 -07:00
|
|
|
capture_output=True,
|
2019-07-02 13:49:17 -07:00
|
|
|
)
|
|
|
|
|
assert proc.stderr == '', proc.stderr
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
pytest.xfail('fish is not installed')
|
|
|
|
|
|
|
|
|
|
|
2021-04-06 01:15:00 -07:00
|
|
|
@pytest.mark.skipif(
|
|
|
|
|
os.name == 'nt', reason="Windows CI workers have bash but are best left alone"
|
|
|
|
|
)
|
2019-07-02 13:49:17 -07:00
|
|
|
def test_bash():
|
|
|
|
|
try:
|
|
|
|
|
proc = run(
|
|
|
|
|
['bash', '-n', 'misc/completion/ocrmypdf.bash'],
|
|
|
|
|
check=True,
|
|
|
|
|
encoding='utf-8',
|
2022-04-03 19:11:06 -07:00
|
|
|
capture_output=True,
|
2019-07-02 13:49:17 -07:00
|
|
|
)
|
|
|
|
|
assert proc.stderr == '', proc.stderr
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
pytest.xfail('bash is not installed')
|