def test_get_ghostscript_binary_windows(pretend_windows, pretend_have_windows_ghostscript): assert treepoem._get_ghostscript_binary() == 'gswin32c'
def test_get_ghostscript_binary_windows_missing(pretend_windows): with pytest.raises(treepoem.TreepoemError) as excinfo: treepoem._get_ghostscript_binary() assert 'Cannot determine path to ghostscript' in str(excinfo.value)
# -*- coding:utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import re import subprocess import sys from treepoem import _get_ghostscript_binary GHOSTSCRIPT_VERSION = subprocess.check_output([ _get_ghostscript_binary(), '--version', ]).decode('utf-8') if not re.match(r'9\.\d\d', GHOSTSCRIPT_VERSION): print( "Ghostscript must be version 9.X, have {}".format(GHOSTSCRIPT_VERSION), ) sys.exit(1) def pytest_report_header(config): return "Ghostscript version: {}".format(GHOSTSCRIPT_VERSION)
# -*- coding:utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import re import subprocess import sys from treepoem import _get_ghostscript_binary GHOSTSCRIPT_VERSION = subprocess.check_output( [_get_ghostscript_binary(), '--version']).decode('utf-8') if not re.match(r'9\.\d\d', GHOSTSCRIPT_VERSION): print( "Ghostscript must be version 9.X, have {}".format(GHOSTSCRIPT_VERSION)) sys.exit(1) def pytest_report_header(config): return "Ghostscript version: {}".format(GHOSTSCRIPT_VERSION)
from __future__ import annotations import re import subprocess from treepoem import _get_ghostscript_binary GHOSTSCRIPT_VERSION = subprocess.check_output( [_get_ghostscript_binary(), "--version"]).decode("utf-8") if not re.match(r"9\.\d\d", GHOSTSCRIPT_VERSION): print(f"Ghostscript must be version 9.X, have {GHOSTSCRIPT_VERSION}") raise SystemExit(1) def pytest_report_header(config): return f"Ghostscript version: {GHOSTSCRIPT_VERSION}"
import re import subprocess import sys from treepoem import _get_ghostscript_binary GHOSTSCRIPT_VERSION = subprocess.check_output( [_get_ghostscript_binary(), "--version"] ).decode("utf-8") if not re.match(r"9\.\d\d", GHOSTSCRIPT_VERSION): print("Ghostscript must be version 9.X, have {}".format(GHOSTSCRIPT_VERSION)) sys.exit(1) def pytest_report_header(config): return "Ghostscript version: {}".format(GHOSTSCRIPT_VERSION)