Remove session scope from fixtures

pytest seems to prepare os.environ in complex ways, so we want to ensure
these fixtures are not reused.
This commit is contained in:
James R. Barlow 2019-12-31 17:09:23 -08:00
parent 2f1c743227
commit 422ea9777e
5 changed files with 10 additions and 10 deletions

View File

@ -131,12 +131,12 @@ def spoof(tmp_path_factory, **kwargs):
return env
@pytest.fixture(scope='session')
@pytest.fixture
def spoof_tesseract_noop(tmp_path_factory):
return spoof(tmp_path_factory, tesseract='tesseract_noop.py')
@pytest.fixture(scope='session')
@pytest.fixture
def spoof_tesseract_cache(tmp_path_factory):
if running_in_docker():
return os.environ.copy()

View File

@ -31,28 +31,28 @@ run_ocrmypdf_api = pytest.helpers.run_ocrmypdf_api
spoof = pytest.helpers.spoof
@pytest.fixture(scope='session')
@pytest.fixture
def spoof_no_tess_gs_render_fail(tmp_path_factory):
return spoof(
tmp_path_factory, tesseract='tesseract_noop.py', gs='gs_render_failure.py'
)
@pytest.fixture(scope='session')
@pytest.fixture
def spoof_no_tess_gs_raster_fail(tmp_path_factory):
return spoof(
tmp_path_factory, tesseract='tesseract_noop.py', gs='gs_raster_failure.py'
)
@pytest.fixture(scope='session')
@pytest.fixture
def spoof_no_tess_no_pdfa(tmp_path_factory):
return spoof(
tmp_path_factory, tesseract='tesseract_noop.py', gs='gs_pdfa_failure.py'
)
@pytest.fixture(scope='session')
@pytest.fixture
def spoof_no_tess_pdfa_warning(tmp_path_factory):
return spoof(
tmp_path_factory, tesseract='tesseract_noop.py', gs='gs_feature_elision.py'

View File

@ -45,12 +45,12 @@ spoof = pytest.helpers.spoof
RENDERERS = ['hocr', 'sandwich']
@pytest.fixture(scope='session')
@pytest.fixture
def spoof_tesseract_crash(tmp_path_factory):
return spoof(tmp_path_factory, tesseract='tesseract_crash.py')
@pytest.fixture(scope='session')
@pytest.fixture
def spoof_tesseract_big_image_error(tmp_path_factory):
return spoof(tmp_path_factory, tesseract='tesseract_big_image_error.py')

View File

@ -33,7 +33,7 @@ run_ocrmypdf_api = pytest.helpers.run_ocrmypdf
spoof = pytest.helpers.spoof
@pytest.fixture(scope='session')
@pytest.fixture
def spoof_tess_bad_utf8(tmp_path_factory):
return spoof(tmp_path_factory, tesseract='tesseract_badutf8.py')

View File

@ -43,7 +43,7 @@ def have_unpaper():
return True
@pytest.fixture(scope="session")
@pytest.fixture
def spoof_unpaper_oldversion(tmp_path_factory):
return spoof(tmp_path_factory, unpaper="unpaper_oldversion.py")