OCRmyPDF/tests/test_completion.py

50 lines
1.2 KiB
Python
Raw Normal View History

# © 2019 James R. Barlow: github.com/jbarlow83
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
2021-04-06 01:15:00 -07:00
import os
2019-12-19 15:29:56 -08:00
from subprocess import PIPE, run
import pytest
2021-04-07 01:56:51 -07:00
from .conftest import running_in_docker
pytestmark = pytest.mark.skipif(
2021-04-07 01:56:51 -07:00
running_in_docker(),
reason="docker can't complete",
)
def test_fish():
try:
proc = run(
['fish', '-n', 'misc/completion/ocrmypdf.fish'],
check=True,
encoding='utf-8',
stdout=PIPE,
stderr=PIPE,
)
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"
)
def test_bash():
try:
proc = run(
['bash', '-n', 'misc/completion/ocrmypdf.bash'],
check=True,
encoding='utf-8',
stdout=PIPE,
stderr=PIPE,
)
assert proc.stderr == '', proc.stderr
except FileNotFoundError:
pytest.xfail('bash is not installed')