Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python310Packages.pikepdf: fix build on aarch64-darwin #175207

Merged
merged 2 commits into from
May 29, 2022

Conversation

dotlambda
Copy link
Member

@dotlambda dotlambda commented May 28, 2022

Description of changes

setup.py refers to Homebrew paths: https://github.com/pikepdf/pikepdf/blob/612f0b86aa957a86ada469641ca6283a13840808/setup.py#L29-L30

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

ZHF: #172160

@dotlambda dotlambda added the 6.topic: darwin Running or building packages on Darwin label May 28, 2022
@ofborg ofborg bot requested a review from Kiwi May 28, 2022 23:14
@ofborg ofborg bot added 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 labels May 28, 2022
@reckenrode
Copy link
Contributor

Result of nixpkgs-review pr 175207 run on aarch64-darwin 1

1 package marked as broken and skipped:
  • paperless-ngx
2 packages failed to build:
  • ocrmypdf (python39Packages.ocrmypdf)
  • python310Packages.ocrmypdf
4 packages built:
  • img2pdf (python39Packages.img2pdf)
  • python310Packages.img2pdf
  • python310Packages.pikepdf
  • python39Packages.pikepdf

@reckenrode
Copy link
Contributor

ocrmypdf is failing due to PermissionError: [Errno 1] Operation not permitted running one of its tests.

______________________ test_unpaper_args_invalid_filename ______________________
[gw5] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld1/pytest-0/popen-gw5/test_unpaper_args_invalid_file0/out.pdf')

    @needs_unpaper
    def test_unpaper_args_invalid_filename(resources, outpdf):
        p = run_ocrmypdf(
            resources / "skew.pdf",
            outpdf,
            "-c",
            "--unpaper-args",
            "/etc/passwd",
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
>       assert "No filenames allowed" in p.stderr
E       assert 'No filenames allowed' in 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/_>
E        +  where 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, i>

tests/test_unpaper.py:88: AssertionError

@dotlambda
Copy link
Member Author

ocrmypdf is failing due to PermissionError: [Errno 1] Operation not permitted running one of its tests

Are there more logs? The ones you posted don't mention PermissionError.

@dotlambda
Copy link
Member Author

Does macOS simply refuse to run any shell command containing /etc/passwd?

@reckenrode
Copy link
Contributor

Does macOS simply refuse to run any shell command containing /etc/passwd?

Might be because I have sandbox = relaxed in /etc/nix/nix.conf.

@reckenrode
Copy link
Contributor

ocrmypdf is failing due to PermissionError: [Errno 1] Operation not permitted running one of its tests

Are there more logs? The ones you posted don't mention PermissionError.

Sorry, it got truncated. Here’s the full log. Looks like there were more errors than I saw initially.

Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing setuptools-build-hook
Using setuptoolsBuildPhase
Using setuptoolsShellHook
Sourcing pip-install-hook
Using pipInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing python-namespaces-hook
Sourcing setuptools-check-hook
Using setuptoolsCheckPhase
Sourcing pytest-check-hook
Using pytestCheckPhase
Removing setuptoolsCheckPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/vk43qpzah01zgacfbdwd49x8w5zp9ac8-source
source root is source
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file source/tests/test_validation.py
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
applying patch /nix/store/sc2z54c7vyv2ibz7wrz0vpixai9v5vzp-paths.patch
patching file src/ocrmypdf/_exec/ghostscript.py
Hunk #1 succeeded at 47 (offset 7 lines).
patching file src/ocrmypdf/_exec/jbig2enc.py
patching file src/ocrmypdf/_exec/pngquant.py
patching file src/ocrmypdf/_exec/tesseract.py
Hunk #1 succeeded at 111 (offset 36 lines).
Hunk #2 succeeded at 138 (offset 41 lines).
Hunk #3 succeeded at 160 (offset 41 lines).
patching file src/ocrmypdf/_exec/unpaper.py
Hunk #1 succeeded at 46 with fuzz 1 (offset 15 lines).
Hunk #2 succeeded at 98 with fuzz 2 (offset 27 lines).
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Executing setuptoolsBuildPhase
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/ocrmypdf
copying src/ocrmypdf/optimize.py -> build/lib/ocrmypdf
copying src/ocrmypdf/_logging.py -> build/lib/ocrmypdf
copying src/ocrmypdf/_graft.py -> build/lib/ocrmypdf
copying src/ocrmypdf/_version.py -> build/lib/ocrmypdf
copying src/ocrmypdf/pluginspec.py -> build/lib/ocrmypdf
copying src/ocrmypdf/__init__.py -> build/lib/ocrmypdf
copying src/ocrmypdf/_concurrent.py -> build/lib/ocrmypdf
copying src/ocrmypdf/api.py -> build/lib/ocrmypdf
copying src/ocrmypdf/cli.py -> build/lib/ocrmypdf
copying src/ocrmypdf/hocrtransform.py -> build/lib/ocrmypdf
copying src/ocrmypdf/_pipeline.py -> build/lib/ocrmypdf
copying src/ocrmypdf/_validation.py -> build/lib/ocrmypdf
copying src/ocrmypdf/exceptions.py -> build/lib/ocrmypdf
copying src/ocrmypdf/_plugin_manager.py -> build/lib/ocrmypdf
copying src/ocrmypdf/_jobcontext.py -> build/lib/ocrmypdf
copying src/ocrmypdf/pdfa.py -> build/lib/ocrmypdf
copying src/ocrmypdf/quality.py -> build/lib/ocrmypdf
copying src/ocrmypdf/helpers.py -> build/lib/ocrmypdf
copying src/ocrmypdf/_sync.py -> build/lib/ocrmypdf
copying src/ocrmypdf/__main__.py -> build/lib/ocrmypdf
creating build/lib/ocrmypdf/pdfinfo
copying src/ocrmypdf/pdfinfo/layout.py -> build/lib/ocrmypdf/pdfinfo
copying src/ocrmypdf/pdfinfo/__init__.py -> build/lib/ocrmypdf/pdfinfo
copying src/ocrmypdf/pdfinfo/info.py -> build/lib/ocrmypdf/pdfinfo
creating build/lib/ocrmypdf/builtin_plugins
copying src/ocrmypdf/builtin_plugins/concurrency.py -> build/lib/ocrmypdf/builtin_plugins
copying src/ocrmypdf/builtin_plugins/__init__.py -> build/lib/ocrmypdf/builtin_plugins
copying src/ocrmypdf/builtin_plugins/default_filters.py -> build/lib/ocrmypdf/builtin_plugins
copying src/ocrmypdf/builtin_plugins/tesseract_ocr.py -> build/lib/ocrmypdf/builtin_plugins
copying src/ocrmypdf/builtin_plugins/ghostscript.py -> build/lib/ocrmypdf/builtin_plugins
creating build/lib/ocrmypdf/subprocess
copying src/ocrmypdf/subprocess/__init__.py -> build/lib/ocrmypdf/subprocess
copying src/ocrmypdf/subprocess/_windows.py -> build/lib/ocrmypdf/subprocess
creating build/lib/ocrmypdf/extra_plugins
copying src/ocrmypdf/extra_plugins/__init__.py -> build/lib/ocrmypdf/extra_plugins
copying src/ocrmypdf/extra_plugins/semfree.py -> build/lib/ocrmypdf/extra_plugins
creating build/lib/ocrmypdf/_exec
copying src/ocrmypdf/_exec/tesseract.py -> build/lib/ocrmypdf/_exec
copying src/ocrmypdf/_exec/__init__.py -> build/lib/ocrmypdf/_exec
copying src/ocrmypdf/_exec/jbig2enc.py -> build/lib/ocrmypdf/_exec
copying src/ocrmypdf/_exec/pngquant.py -> build/lib/ocrmypdf/_exec
copying src/ocrmypdf/_exec/unpaper.py -> build/lib/ocrmypdf/_exec
copying src/ocrmypdf/_exec/ghostscript.py -> build/lib/ocrmypdf/_exec
creating build/lib/ocrmypdf/data
copying src/ocrmypdf/data/__init__.py -> build/lib/ocrmypdf/data
running egg_info
creating src/ocrmypdf.egg-info
writing src/ocrmypdf.egg-info/PKG-INFO
writing dependency_links to src/ocrmypdf.egg-info/dependency_links.txt
writing entry points to src/ocrmypdf.egg-info/entry_points.txt
writing requirements to src/ocrmypdf.egg-info/requires.txt
writing top-level names to src/ocrmypdf.egg-info/top_level.txt
writing manifest file 'src/ocrmypdf.egg-info/SOURCES.txt'
reading manifest file 'src/ocrmypdf.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'src/ocrmypdf.egg-info/SOURCES.txt'
copying src/ocrmypdf/py.typed -> build/lib/ocrmypdf
copying src/ocrmypdf/data/sRGB.icc -> build/lib/ocrmypdf/data
/nix/store/mq0hwzssn3lh36i3f0mdf6djy03vha24-python3.10-setuptools-61.2.0/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
installing to build/bdist.macosx-11.0-arm64/wheel
running install
running install_lib
creating build/bdist.macosx-11.0-arm64
creating build/bdist.macosx-11.0-arm64/wheel
creating build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/optimize.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
creating build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/pdfinfo
copying build/lib/ocrmypdf/pdfinfo/layout.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/pdfinfo
copying build/lib/ocrmypdf/pdfinfo/__init__.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/pdfinfo
copying build/lib/ocrmypdf/pdfinfo/info.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/pdfinfo
copying build/lib/ocrmypdf/_logging.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/_graft.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/_version.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/pluginspec.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
creating build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/builtin_plugins
copying build/lib/ocrmypdf/builtin_plugins/concurrency.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/builtin_plugins
copying build/lib/ocrmypdf/builtin_plugins/__init__.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/builtin_plugins
copying build/lib/ocrmypdf/builtin_plugins/default_filters.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/builtin_plugins
copying build/lib/ocrmypdf/builtin_plugins/tesseract_ocr.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/builtin_plugins
copying build/lib/ocrmypdf/builtin_plugins/ghostscript.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/builtin_plugins
copying build/lib/ocrmypdf/__init__.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/_concurrent.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/api.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
creating build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/subprocess
copying build/lib/ocrmypdf/subprocess/__init__.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/subprocess
copying build/lib/ocrmypdf/subprocess/_windows.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/subprocess
copying build/lib/ocrmypdf/cli.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/hocrtransform.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/_pipeline.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/_validation.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
creating build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/extra_plugins
copying build/lib/ocrmypdf/extra_plugins/__init__.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/extra_plugins
copying build/lib/ocrmypdf/extra_plugins/semfree.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/extra_plugins
creating build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/_exec
copying build/lib/ocrmypdf/_exec/tesseract.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/_exec
copying build/lib/ocrmypdf/_exec/__init__.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/_exec
copying build/lib/ocrmypdf/_exec/jbig2enc.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/_exec
copying build/lib/ocrmypdf/_exec/pngquant.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/_exec
copying build/lib/ocrmypdf/_exec/unpaper.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/_exec
copying build/lib/ocrmypdf/_exec/ghostscript.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/_exec
copying build/lib/ocrmypdf/py.typed -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/exceptions.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/_plugin_manager.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/_jobcontext.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/pdfa.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/quality.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
creating build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/data
copying build/lib/ocrmypdf/data/__init__.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/data
copying build/lib/ocrmypdf/data/sRGB.icc -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf/data
copying build/lib/ocrmypdf/helpers.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/_sync.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
copying build/lib/ocrmypdf/__main__.py -> build/bdist.macosx-11.0-arm64/wheel/ocrmypdf
running install_egg_info
Copying src/ocrmypdf.egg-info to build/bdist.macosx-11.0-arm64/wheel/ocrmypdf-13.4.5-py3.10.egg-info
running install_scripts
creating build/bdist.macosx-11.0-arm64/wheel/ocrmypdf-13.4.5.dist-info/WHEEL
creating 'dist/ocrmypdf-13.4.5-py37-none-any.whl' and adding 'build/bdist.macosx-11.0-arm64/wheel' to it
adding 'ocrmypdf/__init__.py'
adding 'ocrmypdf/__main__.py'
adding 'ocrmypdf/_concurrent.py'
adding 'ocrmypdf/_graft.py'
adding 'ocrmypdf/_jobcontext.py'
adding 'ocrmypdf/_logging.py'
adding 'ocrmypdf/_pipeline.py'
adding 'ocrmypdf/_plugin_manager.py'
adding 'ocrmypdf/_sync.py'
adding 'ocrmypdf/_validation.py'
adding 'ocrmypdf/_version.py'
adding 'ocrmypdf/api.py'
adding 'ocrmypdf/cli.py'
adding 'ocrmypdf/exceptions.py'
adding 'ocrmypdf/helpers.py'
adding 'ocrmypdf/hocrtransform.py'
adding 'ocrmypdf/optimize.py'
adding 'ocrmypdf/pdfa.py'
adding 'ocrmypdf/pluginspec.py'
adding 'ocrmypdf/py.typed'
adding 'ocrmypdf/quality.py'
adding 'ocrmypdf/_exec/__init__.py'
adding 'ocrmypdf/_exec/ghostscript.py'
adding 'ocrmypdf/_exec/jbig2enc.py'
adding 'ocrmypdf/_exec/pngquant.py'
adding 'ocrmypdf/_exec/tesseract.py'
adding 'ocrmypdf/_exec/unpaper.py'
adding 'ocrmypdf/builtin_plugins/__init__.py'
adding 'ocrmypdf/builtin_plugins/concurrency.py'
adding 'ocrmypdf/builtin_plugins/default_filters.py'
adding 'ocrmypdf/builtin_plugins/ghostscript.py'
adding 'ocrmypdf/builtin_plugins/tesseract_ocr.py'
adding 'ocrmypdf/data/__init__.py'
adding 'ocrmypdf/data/sRGB.icc'
adding 'ocrmypdf/extra_plugins/__init__.py'
adding 'ocrmypdf/extra_plugins/semfree.py'
adding 'ocrmypdf/pdfinfo/__init__.py'
adding 'ocrmypdf/pdfinfo/info.py'
adding 'ocrmypdf/pdfinfo/layout.py'
adding 'ocrmypdf/subprocess/__init__.py'
adding 'ocrmypdf/subprocess/_windows.py'
adding 'ocrmypdf-13.4.5.dist-info/LICENSE'
adding 'ocrmypdf-13.4.5.dist-info/METADATA'
adding 'ocrmypdf-13.4.5.dist-info/WHEEL'
adding 'ocrmypdf-13.4.5.dist-info/entry_points.txt'
adding 'ocrmypdf-13.4.5.dist-info/top_level.txt'
adding 'ocrmypdf-13.4.5.dist-info/RECORD'
removing build/bdist.macosx-11.0-arm64/wheel
Finished executing setuptoolsBuildPhase
@nix { "action": "setPhase", "phase": "installPhase" }
installing
Executing pipInstallPhase
/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/dist /private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source
Processing ./ocrmypdf-13.4.5-py37-none-any.whl
Requirement already satisfied: coloredlogs>=14.0 in /nix/store/wfq3qv9iq0z33y4lmybmjd6sjjrm4p4c-python3.10-coloredlogs-15.0.1/lib/python3.10/site-packages (from ocrmypdf==13.4.5) (15.0)
Requirement already satisfied: Pillow>=8.2.0 in /nix/store/m0rykf415z0q6bk2jklrcxq9ym45sf16-python3.10-pillow-9.1.0/lib/python3.10/site-packages (from ocrmypdf==13.4.5) (9.1.0)
Requirement already satisfied: reportlab>=3.5.66 in /nix/store/g3vj3vj167m1bckl1dfa7mmw0w599cgq-python3.10-reportlab-3.6.9/lib/python3.10/site-packages (from ocrmypdf==13.4.5) (3.6.9)
Requirement already satisfied: img2pdf<0.5,>=0.3.0 in /nix/store/3m80ddanmawycs117z6visljgzzb0362-python3.10-img2pdf-0.4.4/lib/python3.10/site-packages (from ocrmypdf==13.4.5) (0.4.4)
Requirement already satisfied: pluggy<2,>=0.13.0 in /nix/store/g9jx2r5j2xzhjan48cvf55qfprp5vp32-python3.10-pluggy-1.0.0/lib/python3.10/site-packages (from ocrmypdf==13.4.5) (1.0.0)
Requirement already satisfied: packaging>=20 in /nix/store/gr2454wzbnrd6315lsb50frkir3vc2in-python3.10-packaging-21.3/lib/python3.10/site-packages (from ocrmypdf==13.4.5) (21.3)
Requirement already satisfied: pikepdf!=5.0.0,>=4.0.0 in /nix/store/8wa06a6wzbdzr6z40xpnm51hds2ga5m2-python3.10-pikepdf-5.1.3/lib/python3.10/site-packages (from ocrmypdf==13.4.5) (5.1.3)
Requirement already satisfied: pdfminer.six!=20200720,>=20191110 in /nix/store/xgdjczb2kbx3fcc1v9q27ga29prmfcvv-python3.10-pdfminer-six-20220524/lib/python3.10/site-packages (from ocrmypdf==13.4.5) (20220524)
Requirement already satisfied: tqdm>=4 in /nix/store/3n8rgndzrbxdnxvqn01wpal5gpa2lr9j-python3.10-tqdm-4.63.1/lib/python3.10/site-packages (from ocrmypdf==13.4.5) (4.63.1)
Requirement already satisfied: humanfriendly>=9.1 in /nix/store/fnxbz6d31r23nldldbx77qh2lx99gah1-python3.10-humanfriendly-10.0/lib/python3.10/site-packages (from coloredlogs>=14.0->ocrmypdf==13.4.5) (10.0)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /nix/store/rvn1ccfx1d3pxriwz9s797ik9w0gvv9f-python3.10-pyparsing-3.0.9/lib/python3.10/site-packages (from packaging>=20->ocrmypdf==13.4.5) (3.0.9)
Requirement already satisfied: cryptography>=36.0.0 in /nix/store/argbrp26ls76cfc6gjkypwcx9w97qnj8-python3.10-cryptography-36.0.2/lib/python3.10/site-packages (from pdfminer.six!=20200720,>=20191110->ocrmypdf==13.4.5) (36.0.2)
Requirement already satisfied: charset-normalizer>=2.0.0 in /nix/store/ars98jd91bcvlmwp5h6qpz0lm9dn9nyc-python3.10-charset-normalizer-2.0.12/lib/python3.10/site-packages (from pdfminer.six!=20200720,>=20191110->ocrmypdf==13.4.5) (2.0.12)
Requirement already satisfied: lxml>=4.0 in /nix/store/j0vpj425r19cm2mwrr21ia5caf2zfmcn-python3.10-lxml-4.8.0/lib/python3.10/site-packages (from pikepdf!=5.0.0,>=4.0.0->ocrmypdf==13.4.5) (4.8.0)
Requirement already satisfied: cffi>=1.12 in /nix/store/a2adfhn6lmgh65y5lidav6wnjiwzbhh6-python3.10-cffi-1.15.0/lib/python3.10/site-packages (from cryptography>=36.0.0->pdfminer.six!=20200720,>=20191110->ocrmypdf==13.4.5) (1.15.0)
Requirement already satisfied: pycparser in /nix/store/0vhsgji17qjsx9zd1xkgm1vp0455i65j-python3.10-pycparser-2.21/lib/python3.10/site-packages (from cffi>=1.12->cryptography>=36.0.0->pdfminer.six!=20200720,>=20191110->ocrmypdf==13.4.5) (2.21)
Installing collected packages: ocrmypdf
Successfully installed ocrmypdf-13.4.5
/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source
Finished executing pipInstallPhase
@nix { "action": "setPhase", "phase": "fixupPhase" }
post-installation fixup
strip is /nix/store/630b4hj9z3gj62c4fw3q7sxy1akql5l4-clang-wrapper-11.1.0/bin/strip
stripping (with command strip and flags -S) in /nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib  /nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/bin 
patching script interpreter paths in /nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5
Rewriting #!/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10 to #!/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4
wrapping `/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/bin/ocrmypdf'...
Executing pythonRemoveTestsDir
Finished executing pythonRemoveTestsDir
@nix { "action": "setPhase", "phase": "installCheckPhase" }
running install tests
no Makefile or custom installCheckPhase, doing nothing
@nix { "action": "setPhase", "phase": "pythonCatchConflictsPhase" }
pythonCatchConflictsPhase
@nix { "action": "setPhase", "phase": "pythonRemoveBinBytecodePhase" }
pythonRemoveBinBytecodePhase
@nix { "action": "setPhase", "phase": "pythonImportsCheckPhase" }
pythonImportsCheckPhase
Executing pythonImportsCheckPhase
Check whether the following modules can be imported: ocrmypdf
@nix { "action": "setPhase", "phase": "pytestXdistHook" }
pytestXdistHook
@nix { "action": "setPhase", "phase": "pytestCheckPhase" }
pytestCheckPhase
Executing pytestCheckPhase
============================= test session starts ==============================
platform darwin -- Python 3.10.4, pytest-7.1.1, pluggy-1.0.0
rootdir: /private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source, configfile: pyproject.toml, testpaths: tests
plugins: xdist-2.5.0, forked-1.4.0
gw0 [318] / gw1 [318] / gw2 [318] / gw3 [318] / gw4 [318] / gw5 [318] / gw6 [318] / gw7 [318] / gw8 [318] / gw9 [318]
s.......x..........sF..F...F.........F..Fx...F..F...F.F..Fs.s..........F [ 22%]
FF.F..s...F......sF.s......ssss....................FF...F............... [ 45%]
................ssssF........x...............................s.s.xssssss [ 67%]
ssssss...ss..FsF.ss....................F...................F..ss........ [ 90%]
......F...FF....FF./nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
..F./nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
...../nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
..                                           [100%]/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

=================================== FAILURES ===================================
____________________________ test_gs_raster_failure ____________________________
[gw2] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw2/test_gs_raster_failure0/out.pdf')

    def test_gs_raster_failure(resources, outpdf):
        p = run_ocrmypdf(
            resources / 'francais.pdf',
            outpdf,
            '--plugin',
            'tests/plugins/tesseract_noop.py',
            '--plugin',
            'tests/plugins/gs_raster_failure.py',
        )
>       assert 'Ghost story archive not found' in p.stderr
E       assert 'Ghost story archive not found' in 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n'
E        +  where 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n' = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').stderr

tests/test_ghostscript.py:102: AssertionError
----------------------------- Captured stderr call -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
____________________________ test_gs_render_failure ____________________________
[gw3] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw3/test_gs_render_failure0/out.pdf')

    def test_gs_render_failure(resources, outpdf):
        p = run_ocrmypdf(
            resources / 'blank.pdf',
            outpdf,
            '--plugin',
            'tests/plugins/tesseract_noop.py',
            '--plugin',
            'tests/plugins/gs_render_failure.py',
        )
>       assert 'Casper is not a friendly ghost' in p.stderr
E       assert 'Casper is not a friendly ghost' in 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n'
E        +  where 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n' = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').stderr

tests/test_ghostscript.py:89: AssertionError
----------------------------- Captured stderr call -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
________________________ test_ghostscript_pdfa_failure _________________________
[gw4] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw4/test_ghostscript_pdfa_failure0/out.pdf')

    def test_ghostscript_pdfa_failure(resources, outpdf):
        p = run_ocrmypdf(
            resources / 'francais.pdf',
            outpdf,
            '--plugin',
            'tests/plugins/tesseract_noop.py',
            '--plugin',
            'tests/plugins/gs_pdfa_failure.py',
        )
>       assert (
            p.returncode == ExitCode.pdfa_conversion_failed
        ), "Unexpected return when PDF/A fails"
E       AssertionError: Unexpected return when PDF/A fails
E       assert 1 == <ExitCode.pdfa_conversion_failed: 10>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.pdfa_conversion_failed: 10> = ExitCode.pdfa_conversion_failed

tests/test_ghostscript.py:115: AssertionError
_________________________________ test_klingon _________________________________
[gw9] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw9/test_klingon0/out.pdf')

    def test_klingon(resources, outpdf):
        p = run_ocrmypdf(resources / 'francais.pdf', outpdf, '-l', 'klz')
>       assert p.returncode == ExitCode.missing_dependency
E       assert 1 == <ExitCode.missing_dependency: 3>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.missing_dependency: 3> = ExitCode.missing_dependency

tests/test_main.py:245: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
__________________________ test_tesseract_crash[hocr] __________________________
[gw4] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
renderer = 'hocr'
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
no_outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw4/test_tesseract_crash_hocr_0/no_output.pdf')

    @pytest.mark.parametrize('renderer', RENDERERS)
    def test_tesseract_crash(renderer, resources, no_outpdf):
        p = run_ocrmypdf(
            resources / 'ccitt.pdf',
            no_outpdf,
            '-v',
            '1',
            '--pdf-renderer',
            renderer,
            '--plugin',
            'tests/plugins/tesseract_crash.py',
        )
>       assert p.returncode == ExitCode.child_process_error
E       assert 1 == <ExitCode.child_process_error: 7>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.child_process_error: 7> = ExitCode.child_process_error

tests/test_main.py:367: AssertionError
__________________________________ test_algo4 __________________________________
[gw9] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw9/test_algo40/out.pdf')

    def test_algo4(resources, outpdf):
        p = run_ocrmypdf(
            resources / 'encrypted_algo4.pdf',
            outpdf,
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
>       assert p.returncode == ExitCode.encrypted_pdf
E       assert 1 == <ExitCode.encrypted_pdf: 8>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.encrypted_pdf: 8> = ExitCode.encrypted_pdf

tests/test_main.py:410: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
______________ test_compression_changed[baiona_gray.png-lossless] ______________
[gw4] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
ocrmypdf_exec = ['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf']
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
image = 'baiona_gray.png', compression = 'lossless'
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw4/test_compression_changed_baion0/out.pdf')

    @pytest.mark.parametrize(
        'image,compression',
        [
            ('baiona.png', 'jpeg'),
            ('baiona_gray.png', 'lossless'),
            ('congress.jpg', 'lossless'),
        ],
    )
    def test_compression_changed(ocrmypdf_exec, resources, image, compression, outpdf):
        input_file = str(resources / image)
        output_file = str(outpdf)
    
        im = Image.open(input_file)
    
        # Runs: ocrmypdf - output.pdf < testfile
        with open(input_file, 'rb') as input_stream:
            p_args = ocrmypdf_exec + [
                '--image-dpi',
                '150',
                '--output-type',
                'pdfa',
                '--optimize',
                '0',
                '--pdfa-image-compression',
                compression,
                '--plugin',
                'tests/plugins/tesseract_noop.py',
                '-',
                output_file,
            ]
            p = run(
                p_args,
                capture_output=True,
                stdin=input_stream,
                text=True,
                check=False,
            )
>           assert p.returncode == ExitCode.ok, p.stderr
E           AssertionError: Traceback (most recent call last):
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 196, in _run_module_as_main
E                 return _run_code(code, main_globals, None,
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 86, in _run_code
E                 exec(code, run_globals)
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 75, in <module>
E                 sys.exit(run())
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 38, in run
E                 os.nice(5)
E             PermissionError: [Errno 1] Operation not permitted
E             
E           assert 1 == <ExitCode.ok: 0>
E            +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E            +  and   <ExitCode.ok: 0> = ExitCode.ok

tests/test_main.py:698: AssertionError
_______________ test_compression_changed[congress.jpg-lossless] ________________
[gw4] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
ocrmypdf_exec = ['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf']
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
image = 'congress.jpg', compression = 'lossless'
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw4/test_compression_changed_congr0/out.pdf')

    @pytest.mark.parametrize(
        'image,compression',
        [
            ('baiona.png', 'jpeg'),
            ('baiona_gray.png', 'lossless'),
            ('congress.jpg', 'lossless'),
        ],
    )
    def test_compression_changed(ocrmypdf_exec, resources, image, compression, outpdf):
        input_file = str(resources / image)
        output_file = str(outpdf)
    
        im = Image.open(input_file)
    
        # Runs: ocrmypdf - output.pdf < testfile
        with open(input_file, 'rb') as input_stream:
            p_args = ocrmypdf_exec + [
                '--image-dpi',
                '150',
                '--output-type',
                'pdfa',
                '--optimize',
                '0',
                '--pdfa-image-compression',
                compression,
                '--plugin',
                'tests/plugins/tesseract_noop.py',
                '-',
                output_file,
            ]
            p = run(
                p_args,
                capture_output=True,
                stdin=input_stream,
                text=True,
                check=False,
            )
>           assert p.returncode == ExitCode.ok, p.stderr
E           AssertionError: Traceback (most recent call last):
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 196, in _run_module_as_main
E                 return _run_code(code, main_globals, None,
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 86, in _run_code
E                 exec(code, run_globals)
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 75, in <module>
E                 sys.exit(run())
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 38, in run
E                 os.nice(5)
E             PermissionError: [Errno 1] Operation not permitted
E             
E           assert 1 == <ExitCode.ok: 0>
E            +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E            +  and   <ExitCode.ok: 0> = ExitCode.ok

tests/test_main.py:698: AssertionError
_____________________ test_force_ocr_on_pdf_with_no_images _____________________
[gw7] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
no_outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw7/test_force_ocr_on_pdf_with_no_0/no_output.pdf')

    def test_force_ocr_on_pdf_with_no_images(resources, no_outpdf):
        # As a correctness test, make sure that --force-ocr on a PDF with no
        # content still triggers tesseract. If tesseract crashes, then it was
        # called.
        p = run_ocrmypdf(
            resources / 'blank.pdf',
            no_outpdf,
            '--force-ocr',
            '--plugin',
            'tests/plugins/tesseract_crash.py',
        )
>       assert p.returncode == ExitCode.child_process_error
E       assert 1 == <ExitCode.child_process_error: 7>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.child_process_error: 7> = ExitCode.child_process_error

tests/test_main.py:213: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
_______________________ test_tesseract_crash_autorotate ________________________
[gw6] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
no_outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw6/test_tesseract_crash_autorotat0/no_output.pdf')

    def test_tesseract_crash_autorotate(resources, no_outpdf):
        p = run_ocrmypdf(
            resources / 'ccitt.pdf',
            no_outpdf,
            '-r',
            '--plugin',
            'tests/plugins/tesseract_crash.py',
        )
>       assert p.returncode == ExitCode.child_process_error
E       assert 1 == <ExitCode.child_process_error: 7>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.child_process_error: 7> = ExitCode.child_process_error

tests/test_main.py:380: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
________________________ test_outputtype_none_bad_setup ________________________
[gw7] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw7/test_outputtype_none_bad_setup0/out.pdf')

    def test_outputtype_none_bad_setup(resources, outpdf):
        p = run_ocrmypdf(
            resources / 'trivial.pdf',
            outpdf,
            '--output-type=none',
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
        assert p.returncode == ExitCode.bad_args
>       assert 'Set the output file to' in p.stderr
E       assert 'Set the output file to' in 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n'
E        +  where 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n' = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').stderr

tests/test_main.py:911: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
______________________________ test_output_is_dir ______________________________
[gw6] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outdir = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw6/test_output_is_dir0')

    def test_output_is_dir(resources, outdir):
        p = run_ocrmypdf(
            resources / 'trivial.pdf',
            outdir,
            '--force-ocr',
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
>       assert p.returncode == ExitCode.file_access_error
E       assert 1 == <ExitCode.file_access_error: 5>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.file_access_error: 5> = ExitCode.file_access_error

tests/test_main.py:824: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
_____________________________ test_outputtype_none _____________________________
[gw7] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outtxt = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw7/test_outputtype_none0/out.txt')

    def test_outputtype_none(resources, outtxt):
        p = run_ocrmypdf(
            resources / 'trivial.pdf',
            '-',
            '--output-type=none',
            '--sidecar',
            outtxt,
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
>       assert p.returncode == ExitCode.ok
E       assert 1 == <ExitCode.ok: 0>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.ok: 0> = ExitCode.ok

tests/test_main.py:924: AssertionError
____________________________ test_output_is_symlink ____________________________
[gw6] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outdir = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw6/test_output_is_symlink0')

    @pytest.mark.skipif(os.name == 'nt', reason="symlink needs admin permissions")
    def test_output_is_symlink(resources, outdir):
        sym = Path(outdir / 'this_is_a_symlink')
        sym.symlink_to(outdir / 'out.pdf')
        p = run_ocrmypdf(
            resources / 'trivial.pdf',
            sym,
            '--force-ocr',
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
>       assert p.returncode == ExitCode.ok, p.stderr
E       AssertionError: Traceback (most recent call last):
E           File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 196, in _run_module_as_main
E             return _run_code(code, main_globals, None,
E           File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 86, in _run_code
E             exec(code, run_globals)
E           File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 75, in <module>
E             sys.exit(run())
E           File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 38, in run
E             os.nice(5)
E         PermissionError: [Errno 1] Operation not permitted
E         
E       assert 1 == <ExitCode.ok: 0>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.ok: 0> = ExitCode.ok

tests/test_main.py:839: AssertionError
________________________________ test_livecycle ________________________________
[gw6] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
no_outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw6/test_livecycle0/no_output.pdf')

    def test_livecycle(resources, no_outpdf):
        p = run_ocrmypdf(resources / 'livecycle.pdf', no_outpdf)
    
>       assert p.returncode == ExitCode.input_file, p.stderr
E       AssertionError: Traceback (most recent call last):
E           File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 196, in _run_module_as_main
E             return _run_code(code, main_globals, None,
E           File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 86, in _run_code
E             exec(code, run_globals)
E           File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 75, in <module>
E             sys.exit(run())
E           File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 38, in run
E             os.nice(5)
E         PermissionError: [Errno 1] Operation not permitted
E         
E       assert 1 == <ExitCode.input_file: 2>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.input_file: 2> = ExitCode.input_file

tests/test_main.py:846: AssertionError
________________________ test_decompression_bomb_error _________________________
[gw4] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw4/test_decompression_bomb_error0/out.pdf')

    def test_decompression_bomb_error(resources, outpdf):
        p = run_ocrmypdf(resources / 'hugemono.pdf', outpdf)
>       assert 'decompression bomb' in p.stderr and '--max-image-mpixels' in p.stderr
E       assert ('decompression bomb' in 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n')
E        +  where 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n' = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').stderr

tests/test_main.py:783: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
_________________________ test_override_metadata[pdfa] _________________________
[gw7] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
output_type = 'pdfa'
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw7/test_override_metadata_pdfa_0/out.pdf')

    @pytest.mark.parametrize("output_type", ['pdfa', 'pdf'])
    def test_override_metadata(output_type, resources, outpdf):
        input_file = resources / 'c02-22.pdf'
        german = 'Du siehst den Wald vor lauter Bäumen nicht.'
        chinese = '孔子'
    
        p = run_ocrmypdf(
            input_file,
            outpdf,
            '--title',
            german,
            '--author',
            chinese,
            '--output-type',
            output_type,
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
    
>       assert p.returncode == ExitCode.ok, p.stderr
E       AssertionError: Traceback (most recent call last):
E           File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 196, in _run_module_as_main
E             return _run_code(code, main_globals, None,
E           File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 86, in _run_code
E             exec(code, run_globals)
E           File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 75, in <module>
E             sys.exit(run())
E           File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 38, in run
E             os.nice(5)
E         PermissionError: [Errno 1] Operation not permitted
E         
E       assert 1 == <ExitCode.ok: 0>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.ok: 0> = ExitCode.ok

tests/test_metadata.py:78: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
________________________ test_destination_not_writable _________________________
[gw9] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outdir = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw9/test_destination_not_writable0')

    def test_destination_not_writable(resources, outdir):
        if os.name != 'nt' and (os.getuid() == 0 or os.geteuid() == 0):
            pytest.xfail(reason="root can write to anything")
        protected_file = outdir / 'protected.pdf'
        protected_file.touch()
        protected_file.chmod(0o400)  # Read-only
        p = run_ocrmypdf(
            resources / 'jbig2.pdf',
            protected_file,
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
>       assert p.returncode == ExitCode.file_access_error, "Expected error"
E       AssertionError: Expected error
E       assert 1 == <ExitCode.file_access_error: 5>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.file_access_error: 5> = ExitCode.file_access_error

tests/test_main.py:480: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
_________________________ test_override_metadata[pdf] __________________________
[gw7] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
output_type = 'pdf'
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw7/test_override_metadata_pdf_0/out.pdf')

    @pytest.mark.parametrize("output_type", ['pdfa', 'pdf'])
    def test_override_metadata(output_type, resources, outpdf):
        input_file = resources / 'c02-22.pdf'
        german = 'Du siehst den Wald vor lauter Bäumen nicht.'
        chinese = '孔子'
    
        p = run_ocrmypdf(
            input_file,
            outpdf,
            '--title',
            german,
            '--author',
            chinese,
            '--output-type',
            output_type,
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
    
>       assert p.returncode == ExitCode.ok, p.stderr
E       AssertionError: Traceback (most recent call last):
E           File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 196, in _run_module_as_main
E             return _run_code(code, main_globals, None,
E           File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 86, in _run_code
E             exec(code, run_globals)
E           File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 75, in <module>
E             sys.exit(run())
E           File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 38, in run
E             os.nice(5)
E         PermissionError: [Errno 1] Operation not permitted
E         
E       assert 1 == <ExitCode.ok: 0>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.ok: 0> = ExitCode.ok

tests/test_metadata.py:78: AssertionError
________________________ test_tesseract_crash[sandwich] ________________________
[gw5] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
renderer = 'sandwich'
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
no_outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw5/test_tesseract_crash_sandwich_0/no_output.pdf')

    @pytest.mark.parametrize('renderer', RENDERERS)
    def test_tesseract_crash(renderer, resources, no_outpdf):
        p = run_ocrmypdf(
            resources / 'ccitt.pdf',
            no_outpdf,
            '-v',
            '1',
            '--pdf-renderer',
            renderer,
            '--plugin',
            'tests/plugins/tesseract_crash.py',
        )
>       assert p.returncode == ExitCode.child_process_error
E       assert 1 == <ExitCode.child_process_error: 7>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.child_process_error: 7> = ExitCode.child_process_error

tests/test_main.py:367: AssertionError
_________________________________ test_stdout __________________________________
[gw4] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
ocrmypdf_exec = ['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf']
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw4/test_stdout0/out.pdf')

    def test_stdout(ocrmypdf_exec, resources, outpdf):
        if 'COV_CORE_DATAFILE' in os.environ:
            pytest.skip("Coverage uses stdout")
    
        input_file = str(resources / 'francais.pdf')
        output_file = str(outpdf)
    
        # Runs: ocrmypdf francais.pdf - > test_stdout.pdf
        with open(output_file, 'wb') as output_stream:
            p_args = ocrmypdf_exec + [
                input_file,
                '-',
                '--plugin',
                'tests/plugins/tesseract_noop.py',
            ]
>           run(p_args, stdout=output_stream, stderr=PIPE, stdin=DEVNULL, check=True)

tests/test_stdio.py:51: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = None, capture_output = False, timeout = None, check = True
popenargs = (['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', '/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources/francais.pdf', '-', '--plugin', ...],)
kwargs = {'stderr': -1, 'stdin': -3, 'stdout': <_io.BufferedWriter name='/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw4/test_stdout0/out.pdf'>}
process = <Popen: returncode: 1 args: ['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-py...>
stdout = None
stderr = b'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.1...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n'
retcode = 1

    def run(*popenargs,
            input=None, capture_output=False, timeout=None, check=False, **kwargs):
        """Run command with arguments and return a CompletedProcess instance.
    
        The returned instance will have attributes args, returncode, stdout and
        stderr. By default, stdout and stderr are not captured, and those attributes
        will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.
    
        If check is True and the exit code was non-zero, it raises a
        CalledProcessError. The CalledProcessError object will have the return code
        in the returncode attribute, and output & stderr attributes if those streams
        were captured.
    
        If timeout is given, and the process takes too long, a TimeoutExpired
        exception will be raised.
    
        There is an optional argument "input", allowing you to
        pass bytes or a string to the subprocess's stdin.  If you use this argument
        you may not also use the Popen constructor's "stdin" argument, as
        it will be used internally.
    
        By default, all communication is in bytes, and therefore any "input" should
        be bytes, and the stdout and stderr will be bytes. If in text mode, any
        "input" should be a string, and stdout and stderr will be strings decoded
        according to locale encoding, or by "encoding" if set. Text mode is
        triggered by setting any of text, encoding, errors or universal_newlines.
    
        The other arguments are the same as for the Popen constructor.
        """
        if input is not None:
            if kwargs.get('stdin') is not None:
                raise ValueError('stdin and input arguments may not both be used.')
            kwargs['stdin'] = PIPE
    
        if capture_output:
            if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
                raise ValueError('stdout and stderr arguments may not be used '
                                 'with capture_output.')
            kwargs['stdout'] = PIPE
            kwargs['stderr'] = PIPE
    
        with Popen(*popenargs, **kwargs) as process:
            try:
                stdout, stderr = process.communicate(input, timeout=timeout)
            except TimeoutExpired as exc:
                process.kill()
                if _mswindows:
                    # Windows accumulates the output in a single blocking
                    # read() call run on child threads, with the timeout
                    # being done in a join() on those threads.  communicate()
                    # _after_ kill() is required to collect that and add it
                    # to the exception.
                    exc.stdout, exc.stderr = process.communicate()
                else:
                    # POSIX _communicate already populated the output so
                    # far into the TimeoutExpired exception.
                    process.wait()
                raise
            except:  # Including KeyboardInterrupt, communicate handled that.
                process.kill()
                # We don't call process.wait() as .__exit__ does that for us.
                raise
            retcode = process.poll()
            if check and retcode:
>               raise CalledProcessError(retcode, process.args,
                                         output=stdout, stderr=stderr)
E               subprocess.CalledProcessError: Command '['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', '/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources/francais.pdf', '-', '--plugin', 'tests/plugins/tesseract_noop.py']' returned non-zero exit status 1.

/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/subprocess.py:524: CalledProcessError
__________________________________ test_stdin __________________________________
[gw6] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
ocrmypdf_exec = ['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf']
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw6/test_stdin0/out.pdf')

    def test_stdin(ocrmypdf_exec, resources, outpdf):
        input_file = str(resources / 'francais.pdf')
        output_file = str(outpdf)
    
        # Runs: ocrmypdf - output.pdf < testfile.pdf
        with open(input_file, 'rb') as input_stream:
            p_args = ocrmypdf_exec + [
                '-',
                output_file,
                '--plugin',
                'tests/plugins/tesseract_noop.py',
            ]
>           run(p_args, capture_output=True, stdin=input_stream, check=True)

tests/test_stdio.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = None, capture_output = True, timeout = None, check = True
popenargs = (['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', '-', '/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw6/test_stdin0/out.pdf', '--plugin', ...],)
kwargs = {'stderr': -1, 'stdin': <_io.BufferedReader name='/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources/francais.pdf'>, 'stdout': -1}
process = <Popen: returncode: 1 args: ['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-py...>
stdout = b''
stderr = b'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.1...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n'
retcode = 1

    def run(*popenargs,
            input=None, capture_output=False, timeout=None, check=False, **kwargs):
        """Run command with arguments and return a CompletedProcess instance.
    
        The returned instance will have attributes args, returncode, stdout and
        stderr. By default, stdout and stderr are not captured, and those attributes
        will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.
    
        If check is True and the exit code was non-zero, it raises a
        CalledProcessError. The CalledProcessError object will have the return code
        in the returncode attribute, and output & stderr attributes if those streams
        were captured.
    
        If timeout is given, and the process takes too long, a TimeoutExpired
        exception will be raised.
    
        There is an optional argument "input", allowing you to
        pass bytes or a string to the subprocess's stdin.  If you use this argument
        you may not also use the Popen constructor's "stdin" argument, as
        it will be used internally.
    
        By default, all communication is in bytes, and therefore any "input" should
        be bytes, and the stdout and stderr will be bytes. If in text mode, any
        "input" should be a string, and stdout and stderr will be strings decoded
        according to locale encoding, or by "encoding" if set. Text mode is
        triggered by setting any of text, encoding, errors or universal_newlines.
    
        The other arguments are the same as for the Popen constructor.
        """
        if input is not None:
            if kwargs.get('stdin') is not None:
                raise ValueError('stdin and input arguments may not both be used.')
            kwargs['stdin'] = PIPE
    
        if capture_output:
            if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
                raise ValueError('stdout and stderr arguments may not be used '
                                 'with capture_output.')
            kwargs['stdout'] = PIPE
            kwargs['stderr'] = PIPE
    
        with Popen(*popenargs, **kwargs) as process:
            try:
                stdout, stderr = process.communicate(input, timeout=timeout)
            except TimeoutExpired as exc:
                process.kill()
                if _mswindows:
                    # Windows accumulates the output in a single blocking
                    # read() call run on child threads, with the timeout
                    # being done in a join() on those threads.  communicate()
                    # _after_ kill() is required to collect that and add it
                    # to the exception.
                    exc.stdout, exc.stderr = process.communicate()
                else:
                    # POSIX _communicate already populated the output so
                    # far into the TimeoutExpired exception.
                    process.wait()
                raise
            except:  # Including KeyboardInterrupt, communicate handled that.
                process.kill()
                # We don't call process.wait() as .__exit__ does that for us.
                raise
            retcode = process.poll()
            if check and retcode:
>               raise CalledProcessError(retcode, process.args,
                                         output=stdout, stderr=stderr)
E               subprocess.CalledProcessError: Command '['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', '-', '/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw6/test_stdin0/out.pdf', '--plugin', 'tests/plugins/tesseract_noop.py']' returned non-zero exit status 1.

/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/subprocess.py:524: CalledProcessError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
________________________________ test_dev_null _________________________________
[gw6] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')

    @pytest.mark.xfail(
        os.name == 'nt' and sys.version_info < (3, 8),
        reason="Windows does not like this; not sure how to fix",
    )
    def test_dev_null(resources):
        if 'COV_CORE_DATAFILE' in os.environ:
            pytest.skip("Coverage uses stdout")
    
        p = run_ocrmypdf(
            resources / 'trivial.pdf',
            os.devnull,
            '--force-ocr',
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
>       assert p.returncode == 0, "could not send output to /dev/null"
E       AssertionError: could not send output to /dev/null
E       assert 1 == 0
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode

tests/test_stdio.py:84: AssertionError
____________________ test_compression_preserved[baiona.png] ____________________
[gw1] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
ocrmypdf_exec = ['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf']
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
image = 'baiona.png'
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw1/test_compression_preserved_bai0/out.pdf')

    @pytest.mark.parametrize(
        'image', ['baiona.png', 'baiona_gray.png', 'baiona_alpha.png', 'congress.jpg']
    )
    def test_compression_preserved(ocrmypdf_exec, resources, image, outpdf):
        input_file = str(resources / image)
        output_file = str(outpdf)
    
        im = Image.open(input_file)
        # Runs: ocrmypdf - output.pdf < testfile
        with open(input_file, 'rb') as input_stream:
            p_args = ocrmypdf_exec + [
                '--optimize',
                '0',
                '--image-dpi',
                '150',
                '--output-type',
                'pdf',
                '--plugin',
                'tests/plugins/tesseract_noop.py',
                '-',
                output_file,
            ]
            p = run(
                p_args,
                capture_output=True,
                stdin=input_stream,
                text=True,
                check=False,
            )
    
            if im.mode in ('RGBA', 'LA'):
                # If alpha image is input, expect an error
                assert p.returncode != ExitCode.ok and 'alpha' in p.stderr
                return
    
>           assert p.returncode == ExitCode.ok, p.stderr
E           AssertionError: Traceback (most recent call last):
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 196, in _run_module_as_main
E                 return _run_code(code, main_globals, None,
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 86, in _run_code
E                 exec(code, run_globals)
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 75, in <module>
E                 sys.exit(run())
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 38, in run
E                 os.nice(5)
E             PermissionError: [Errno 1] Operation not permitted
E             
E           assert 1 == <ExitCode.ok: 0>
E            +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E            +  and   <ExitCode.ok: 0> = ExitCode.ok

tests/test_main.py:644: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
_________________ test_compression_preserved[baiona_gray.png] __________________
[gw1] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
ocrmypdf_exec = ['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf']
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
image = 'baiona_gray.png'
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw1/test_compression_preserved_bai0/out.pdf')

    @pytest.mark.parametrize(
        'image', ['baiona.png', 'baiona_gray.png', 'baiona_alpha.png', 'congress.jpg']
    )
    def test_compression_preserved(ocrmypdf_exec, resources, image, outpdf):
        input_file = str(resources / image)
        output_file = str(outpdf)
    
        im = Image.open(input_file)
        # Runs: ocrmypdf - output.pdf < testfile
        with open(input_file, 'rb') as input_stream:
            p_args = ocrmypdf_exec + [
                '--optimize',
                '0',
                '--image-dpi',
                '150',
                '--output-type',
                'pdf',
                '--plugin',
                'tests/plugins/tesseract_noop.py',
                '-',
                output_file,
            ]
            p = run(
                p_args,
                capture_output=True,
                stdin=input_stream,
                text=True,
                check=False,
            )
    
            if im.mode in ('RGBA', 'LA'):
                # If alpha image is input, expect an error
                assert p.returncode != ExitCode.ok and 'alpha' in p.stderr
                return
    
>           assert p.returncode == ExitCode.ok, p.stderr
E           AssertionError: Traceback (most recent call last):
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 196, in _run_module_as_main
E                 return _run_code(code, main_globals, None,
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 86, in _run_code
E                 exec(code, run_globals)
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 75, in <module>
E                 sys.exit(run())
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 38, in run
E                 os.nice(5)
E             PermissionError: [Errno 1] Operation not permitted
E             
E           assert 1 == <ExitCode.ok: 0>
E            +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E            +  and   <ExitCode.ok: 0> = ExitCode.ok

tests/test_main.py:644: AssertionError
_________________ test_compression_preserved[baiona_alpha.png] _________________
[gw1] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
ocrmypdf_exec = ['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf']
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
image = 'baiona_alpha.png'
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw1/test_compression_preserved_bai0/out.pdf')

    @pytest.mark.parametrize(
        'image', ['baiona.png', 'baiona_gray.png', 'baiona_alpha.png', 'congress.jpg']
    )
    def test_compression_preserved(ocrmypdf_exec, resources, image, outpdf):
        input_file = str(resources / image)
        output_file = str(outpdf)
    
        im = Image.open(input_file)
        # Runs: ocrmypdf - output.pdf < testfile
        with open(input_file, 'rb') as input_stream:
            p_args = ocrmypdf_exec + [
                '--optimize',
                '0',
                '--image-dpi',
                '150',
                '--output-type',
                'pdf',
                '--plugin',
                'tests/plugins/tesseract_noop.py',
                '-',
                output_file,
            ]
            p = run(
                p_args,
                capture_output=True,
                stdin=input_stream,
                text=True,
                check=False,
            )
    
            if im.mode in ('RGBA', 'LA'):
                # If alpha image is input, expect an error
>               assert p.returncode != ExitCode.ok and 'alpha' in p.stderr
E               assert (1 != <ExitCode.ok: 0> and 'alpha' in 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n')
E                +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E                +  and   <ExitCode.ok: 0> = ExitCode.ok
E                +  and   'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n' = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').stderr

tests/test_main.py:641: AssertionError
___________________ test_compression_preserved[congress.jpg] ___________________
[gw1] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
ocrmypdf_exec = ['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf']
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
image = 'congress.jpg'
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw1/test_compression_preserved_con0/out.pdf')

    @pytest.mark.parametrize(
        'image', ['baiona.png', 'baiona_gray.png', 'baiona_alpha.png', 'congress.jpg']
    )
    def test_compression_preserved(ocrmypdf_exec, resources, image, outpdf):
        input_file = str(resources / image)
        output_file = str(outpdf)
    
        im = Image.open(input_file)
        # Runs: ocrmypdf - output.pdf < testfile
        with open(input_file, 'rb') as input_stream:
            p_args = ocrmypdf_exec + [
                '--optimize',
                '0',
                '--image-dpi',
                '150',
                '--output-type',
                'pdf',
                '--plugin',
                'tests/plugins/tesseract_noop.py',
                '-',
                output_file,
            ]
            p = run(
                p_args,
                capture_output=True,
                stdin=input_stream,
                text=True,
                check=False,
            )
    
            if im.mode in ('RGBA', 'LA'):
                # If alpha image is input, expect an error
                assert p.returncode != ExitCode.ok and 'alpha' in p.stderr
                return
    
>           assert p.returncode == ExitCode.ok, p.stderr
E           AssertionError: Traceback (most recent call last):
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 196, in _run_module_as_main
E                 return _run_code(code, main_globals, None,
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 86, in _run_code
E                 exec(code, run_globals)
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 75, in <module>
E                 sys.exit(run())
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 38, in run
E                 os.nice(5)
E             PermissionError: [Errno 1] Operation not permitted
E             
E           assert 1 == <ExitCode.ok: 0>
E            +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E            +  and   <ExitCode.ok: 0> = ExitCode.ok

tests/test_main.py:644: AssertionError
__________________ test_compression_changed[baiona.png-jpeg] ___________________
[gw1] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
ocrmypdf_exec = ['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf']
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
image = 'baiona.png', compression = 'jpeg'
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw1/test_compression_changed_baion0/out.pdf')

    @pytest.mark.parametrize(
        'image,compression',
        [
            ('baiona.png', 'jpeg'),
            ('baiona_gray.png', 'lossless'),
            ('congress.jpg', 'lossless'),
        ],
    )
    def test_compression_changed(ocrmypdf_exec, resources, image, compression, outpdf):
        input_file = str(resources / image)
        output_file = str(outpdf)
    
        im = Image.open(input_file)
    
        # Runs: ocrmypdf - output.pdf < testfile
        with open(input_file, 'rb') as input_stream:
            p_args = ocrmypdf_exec + [
                '--image-dpi',
                '150',
                '--output-type',
                'pdfa',
                '--optimize',
                '0',
                '--pdfa-image-compression',
                compression,
                '--plugin',
                'tests/plugins/tesseract_noop.py',
                '-',
                output_file,
            ]
            p = run(
                p_args,
                capture_output=True,
                stdin=input_stream,
                text=True,
                check=False,
            )
>           assert p.returncode == ExitCode.ok, p.stderr
E           AssertionError: Traceback (most recent call last):
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 196, in _run_module_as_main
E                 return _run_code(code, main_globals, None,
E               File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/runpy.py", line 86, in _run_code
E                 exec(code, run_globals)
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 75, in <module>
E                 sys.exit(run())
E               File "/nix/store/rf6j47nci7lra14nzfkcj734i9xc5ng1-python3.10-ocrmypdf-13.4.5/lib/python3.10/site-packages/ocrmypdf/__main__.py", line 38, in run
E                 os.nice(5)
E             PermissionError: [Errno 1] Operation not permitted
E             
E           assert 1 == <ExitCode.ok: 0>
E            +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E            +  and   <ExitCode.ok: 0> = ExitCode.ok

tests/test_main.py:698: AssertionError
__________________________ test_unpaper_args_invalid ___________________________
[gw6] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw6/test_unpaper_args_invalid0/out.pdf')

    @needs_unpaper
    def test_unpaper_args_invalid(resources, outpdf):
        p = run_ocrmypdf(
            resources / "skew.pdf",
            outpdf,
            "-c",
            "--unpaper-args",
            "unpaper is not going to like these arguments",
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
        # Can't tell difference between unpaper choking on bad arguments or some
        # other unpaper failure
>       assert p.returncode == ExitCode.child_process_error
E       assert 1 == <ExitCode.child_process_error: 7>
E        +  where 1 = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').returncode
E        +  and   <ExitCode.child_process_error: 7> = ExitCode.child_process_error

tests/test_unpaper.py:105: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
______________________ test_unpaper_args_invalid_filename ______________________
[gw5] darwin -- Python 3.10.4 /nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10
resources = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/source/tests/resources')
outpdf = PosixPath('/private/tmp/nix-build-python3.10-ocrmypdf-13.4.5.drv-0/pytest-of-_nixbld3/pytest-0/popen-gw5/test_unpaper_args_invalid_file0/out.pdf')

    @needs_unpaper
    def test_unpaper_args_invalid_filename(resources, outpdf):
        p = run_ocrmypdf(
            resources / "skew.pdf",
            outpdf,
            "-c",
            "--unpaper-args",
            "__file__",
            '--plugin',
            'tests/plugins/tesseract_noop.py',
        )
>       assert "No filenames allowed" in p.stderr
E       assert 'No filenames allowed' in 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n'
E        +  where 'Traceback (most recent call last):\n  File "/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10...-packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n' = CompletedProcess(args=['/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/bin/python3.10', '-m', 'ocrmypdf', ...packages/ocrmypdf/__main__.py", line 38, in run\n    os.nice(5)\nPermissionError: [Errno 1] Operation not permitted\n').stderr

tests/test_unpaper.py:88: AssertionError
---------------------------- Captured stderr setup -----------------------------
/nix/store/9ds1mv2cpdii4nv56jszcsfgk0lc0r6m-python3-3.10.4/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
=============================== warnings summary ===============================
<frozen importlib._bootstrap>:283: 11 warnings
  <frozen importlib._bootstrap>:283: DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_ghostscript.py::test_gs_raster_failure
FAILED tests/test_ghostscript.py::test_gs_render_failure
FAILED tests/test_ghostscript.py::test_ghostscript_pdfa_failure
FAILED tests/test_main.py::test_klingon
FAILED tests/test_main.py::test_tesseract_crash[hocr]
FAILED tests/test_main.py::test_algo4
FAILED tests/test_main.py::test_compression_changed[baiona_gray.png-lossless]
FAILED tests/test_main.py::test_compression_changed[congress.jpg-lossless]
FAILED tests/test_main.py::test_force_ocr_on_pdf_with_no_images
FAILED tests/test_main.py::test_tesseract_crash_autorotate
FAILED tests/test_main.py::test_outputtype_none_bad_setup
FAILED tests/test_main.py::test_output_is_dir
FAILED tests/test_main.py::test_outputtype_none
FAILED tests/test_main.py::test_output_is_symlink
FAILED tests/test_main.py::test_livecycle
FAILED tests/test_main.py::test_decompression_bomb_error
FAILED tests/test_metadata.py::test_override_metadata[pdfa]
FAILED tests/test_main.py::test_destination_not_writable
FAILED tests/test_metadata.py::test_override_metadata[pdf]
FAILED tests/test_main.py::test_tesseract_crash[sandwich]
FAILED tests/test_stdio.py::test_stdout
FAILED tests/test_stdio.py::test_stdin
FAILED tests/test_stdio.py::test_dev_null
FAILED tests/test_main.py::test_compression_preserved[baiona.png]
FAILED tests/test_main.py::test_compression_preserved[baiona_gray.png]
FAILED tests/test_main.py::test_compression_preserved[baiona_alpha.png]
FAILED tests/test_main.py::test_compression_preserved[congress.jpg]
FAILED tests/test_main.py::test_compression_changed[baiona.png-jpeg]
FAILED tests/test_unpaper.py::test_unpaper_args_invalid
FAILED tests/test_unpaper.py::test_unpaper_args_invalid_filename
= 30 failed, 248 passed, 36 skipped, 4 xfailed, 11 warnings in 68.71s (0:01:08) =

@reckenrode
Copy link
Contributor

ocrmypdf builds if I disable sandboxing completely.

@dotlambda dotlambda force-pushed the pikepdf-darwin branch 2 times, most recently from 1e6ada4 to 326cb76 Compare May 29, 2022 00:48
@reckenrode
Copy link
Contributor

Result of nixpkgs-review pr 175207 run on aarch64-darwin 1

1 package marked as broken and skipped:
  • paperless-ngx
6 packages built:
  • img2pdf (python39Packages.img2pdf)
  • ocrmypdf (python39Packages.ocrmypdf)
  • python310Packages.img2pdf
  • python310Packages.ocrmypdf
  • python310Packages.pikepdf
  • python39Packages.pikepdf

@dotlambda
Copy link
Member Author

6 packages built

Was that with or without sandbox?

@reckenrode
Copy link
Contributor

reckenrode commented May 29, 2022

Not sure if it’s the best approach, but the latest change fixes the ocrmypdf build failure with sandboxing enabled on Darwin.

@reckenrode
Copy link
Contributor

6 packages built

Was that with or without sandbox?

With. If I nix build .#ocrmypdf without the change, it fails as usual.

@dotlambda
Copy link
Member Author

Not sure if it’s the best approach, but the latest change fixes the ocrmypdf build failure with sandboxing enabled on Darwin.

os.nice() is definitely optional. I opened a PR upstream: ocrmypdf/OCRmyPDF#973
I'll change it to use fetchpatch, wait for ofborg, and then merge.

@dotlambda dotlambda marked this pull request as ready for review May 29, 2022 01:03
@dotlambda dotlambda requested review from FRidh and jonringer as code owners May 29, 2022 01:03
With enabled sandbox we get
    PermissionError: [Errno 1] Operation not permitted
when calling os.nice().
@dotlambda dotlambda merged commit b021b30 into NixOS:master May 29, 2022
@github-actions
Copy link
Contributor

Successfully created backport PR #175232 for release-22.05.

@dotlambda dotlambda restored the pikepdf-darwin branch May 29, 2022 03:56
@dotlambda dotlambda deleted the pikepdf-darwin branch May 29, 2022 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin 6.topic: python 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants