Remove .coveragerc and fold into setup.cfg

This commit is contained in:
James R. Barlow 2021-01-06 03:58:18 -08:00
parent 47ef1914d4
commit 2846d46bb8
No known key found for this signature in database
GPG Key ID: E54A300D567E1260
5 changed files with 33 additions and 35 deletions

View File

@ -1,24 +0,0 @@
[paths]
source =
src
*/site-packages
[run]
branch = true
parallel = true
concurrency =
thread
multiprocessing
source =
src/ocrmypdf
[report]
exclude_lines =
pragma: no cover
def __repr__
raise AssertionError
raise NotImplementedError
if 0:
if False:
if __name__ == .__main__.:
if TYPE_CHECKING:

View File

@ -15,6 +15,8 @@ filterwarnings =
ignore:.*XMLParser.*:DeprecationWarning
markers =
slow
addopts =
-n auto
[isort]
multi_line_output=3
@ -27,3 +29,30 @@ known_third_party = PIL,_cffi_backend,cffi,flask,img2pdf,pdfminer,pikepdf,pkg_re
[metadata]
license_file = LICENSE
[coverage:paths]
source =
src/
[coverage:run]
branch = true
parallel = true
concurrency = multiprocessing
source =
src/ocrmypdf
[coverage:report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
# Don't complain if non-runnable code isn't run:
if 0:
if False:
if __name__ == .__main__.:
if TYPE_CHECKING:

View File

@ -338,6 +338,8 @@ def run_pipeline(options, *, plugin_manager, api=False):
and not api
):
# Debug log for command line interface only with verbose output
# See https://github.com/pytest-dev/pytest/issues/5502 for why we skip this
# when pytest is running
debug_log_handler = configure_debug_logging(Path(work_folder) / "debug.log")
pikepdf_enable_mmap()

View File

@ -498,7 +498,7 @@ def transcode_pngs(
@deprecated
def rewrite_png_as_g4(pike: Pdf, im_obj: Object, compdata) -> None:
def rewrite_png_as_g4(pike: Pdf, im_obj: Object, compdata) -> None: # pragma: no cover
im_obj.BitsPerComponent = 1
im_obj.Width = compdata.w
im_obj.Height = compdata.h
@ -519,7 +519,7 @@ def rewrite_png_as_g4(pike: Pdf, im_obj: Object, compdata) -> None:
@deprecated
def rewrite_png(pike: Pdf, im_obj: Object, compdata) -> None:
def rewrite_png(pike: Pdf, im_obj: Object, compdata) -> None: # pragma: no cover
# When a PNG is inserted into a PDF, we more or less copy the IDAT section from
# the PDF and transfer the rest of the PNG headers to PDF image metadata.
# One thing we have to do is tell the PDF reader whether a predictor was used

View File

@ -137,16 +137,7 @@ def run_ocrmypdf(input_file, output_file, *args, text=True):
+ [str(input_file), str(output_file)]
)
# Tell subprocess where to find coverage.py configuration
# 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'
env = os.environ.copy()
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,
stdout=PIPE,