From 0cc23b999c3340ce365679dba28cf275f5c40b19 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Wed, 3 Oct 2018 15:04:46 -0700 Subject: [PATCH] test: fix pytest warning about direct use of a fixture --- tests/test_tess4.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_tess4.py b/tests/test_tess4.py index be4c5af7..859b3cbb 100644 --- a/tests/test_tess4.py +++ b/tests/test_tess4.py @@ -29,8 +29,7 @@ from pathlib import Path spoof = pytest.helpers.spoof -@pytest.fixture -def ensure_tess4(): +def _ensure_tess4(): if tesseract.v4(): # "tesseract" on $PATH is already v4 return os.environ.copy() @@ -49,6 +48,11 @@ def ensure_tess4(): raise EnvironmentError("Can't find Tesseract 4") +@pytest.fixture +def ensure_tess4(): + return _ensure_tess4() + + @contextmanager def modified_os_environ(env): old_env = os.environ.copy() @@ -63,8 +67,8 @@ def tess4_available(): """ try: - # ensure_tess4 locates the tess4 binary we are going to check - env = ensure_tess4() + # _ensure_tess4 locates the tess4 binary we are going to check + env = _ensure_tess4() with modified_os_environ(env): # Now jump into this environment and make sure it really is Tess4 return tesseract.v4() and tesseract.has_textonly_pdf()