"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/conftest.py" between
OCRmyPDF-8.0.1.tar.gz and OCRmyPDF-8.1.0.tar.gz

About: OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched.

conftest.py  (OCRmyPDF-8.0.1):conftest.py  (OCRmyPDF-8.1.0)
skipping to change at line 135 skipping to change at line 135
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def no_outpdf(tmpdir): def no_outpdf(tmpdir):
"""This just documents the fact that a test is not expected to produce """This just documents the fact that a test is not expected to produce
output. Unfortunately an assertion failure inside a test fixture produces output. Unfortunately an assertion failure inside a test fixture produces
an error rather than a test failure, so no testing is done. It's up to an error rather than a test failure, so no testing is done. It's up to
the test to confirm that no output file was created.""" the test to confirm that no output file was created."""
return str(Path(str(tmpdir)) / 'no_output.pdf') return str(Path(str(tmpdir)) / 'no_output.pdf')
@pytest.helpers.register @pytest.helpers.register
def check_ocrmypdf(input_file, output_file, *args, env=None): def check_ocrmypdf(input_file, output_file, *args, env=None):
"Run ocrmypdf and confirmed that a valid file was created" """Run ocrmypdf and confirmed that a valid file was created"""
p, out, err = run_ocrmypdf(input_file, output_file, *args, env=env) p, out, err = run_ocrmypdf(input_file, output_file, *args, env=env)
# ensure py.test collects the output, use -s to view # ensure py.test collects the output, use -s to view
print(err, file=sys.stderr) print(err, file=sys.stderr)
assert p.returncode == 0 assert p.returncode == 0
assert os.path.exists(str(output_file)), "Output file not created" assert os.path.exists(str(output_file)), "Output file not created"
assert os.stat(str(output_file)).st_size > 100, "PDF too small or empty" assert os.stat(str(output_file)).st_size > 100, "PDF too small or empty"
assert out == "", ( assert out == "", (
"The following was written to stdout and should not have been: \n" "The following was written to stdout and should not have been: \n"
+ "<stdout>\n" + "<stdout>\n"
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)