Fix some tests that were failing in Docker
This commit is contained in:
+5
-3
@@ -148,12 +148,14 @@ def run_ocrmypdf(input_file, output_file, *args, universal_newlines=True):
|
||||
)
|
||||
|
||||
# Tell subprocess where to find coverage.py configuration
|
||||
# This has no effect except when coverage is running
|
||||
# This has no unless except when coverage is running
|
||||
# Details: https://coverage.readthedocs.io/en/coverage-5.0/subprocess.html
|
||||
coverage_rc = Path(__file__).parent.parent / '.coveragerc'
|
||||
assert coverage_rc.exists()
|
||||
env = os.environ.copy()
|
||||
env['COVERAGE_PROCESS_START'] = os.fspath(coverage_rc)
|
||||
if coverage_rc.exists():
|
||||
env['COVERAGE_PROCESS_START'] = os.fspath(coverage_rc)
|
||||
elif not running_in_docker():
|
||||
assert False, "could not find .coveragerc"
|
||||
|
||||
p = run(
|
||||
p_args,
|
||||
|
||||
@@ -64,6 +64,11 @@ def test_deprecated():
|
||||
assert old_function() == 42
|
||||
|
||||
|
||||
skipif_docker = pytest.mark.skipif(
|
||||
pytest.helpers.running_in_docker(), reason="fails on Docker"
|
||||
)
|
||||
|
||||
|
||||
class TestFileIsWritable:
|
||||
@pytest.fixture
|
||||
def non_existent(self, tmp_path):
|
||||
@@ -83,6 +88,7 @@ class TestFileIsWritable:
|
||||
loop.symlink_to(loop)
|
||||
assert not helpers.is_file_writable(loop)
|
||||
|
||||
@skipif_docker
|
||||
def test_chmod(self, basic_file):
|
||||
assert helpers.is_file_writable(basic_file)
|
||||
basic_file.chmod(0o400)
|
||||
|
||||
+3
-1
@@ -279,7 +279,9 @@ def test_input_file_not_found(caplog, no_outpdf):
|
||||
assert input_file in caplog.text
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.name == 'nt', reason="chmod")
|
||||
@pytest.mark.skipif(
|
||||
os.name == 'nt' or pytest.helpers.running_in_docker(), reason="chmod"
|
||||
)
|
||||
def test_input_file_not_readable(caplog, resources, outdir, no_outpdf):
|
||||
input_file = outdir / 'trivial.pdf'
|
||||
shutil.copy(resources / 'trivial.pdf', input_file)
|
||||
|
||||
Reference in New Issue
Block a user