==> Building on minun ==> Checking for remote environment... ==> Syncing package to remote host... sending incremental file list ./ PKGBUILD 700 26% 0.00kB/s 0:00:00 2,682 100% 1.89MB/s 0:00:00 (xfr#1, to-chk=1/3) rst2pdf-0.99-2.log 204 100% 199.22kB/s 0:00:00 204 100% 199.22kB/s 0:00:00 (xfr#2, to-chk=0/3) sent 336 bytes received 87 bytes 282.00 bytes/sec total size is 2,874 speedup is 6.79 ==> Running extra-riscv64-build -- -d /home/felix/packages/riscv64-pkg-cache:/var/cache/pacman/pkg -l felix0 on remote host... [?25l:: Synchronizing package databases... core downloading... extra downloading... community downloading... :: Starting full system upgrade... there is nothing to do [?25h==> Building in chroot for [extra] (riscv64)... ==> Synchronizing chroot copy [/var/lib/archbuild/extra-riscv64/root] -> [felix0]...done ==> Making package: rst2pdf 0.99-2 (Mon Feb 27 22:08:17 2023) ==> Retrieving sources...  -> Found rst2pdf-0.99.tar.gz ==> Validating source files with sha512sums... rst2pdf-0.99.tar.gz ... Passed ==> Validating source files with b2sums... rst2pdf-0.99.tar.gz ... Passed ==> Making package: rst2pdf 0.99-2 (Mon Feb 27 22:08:25 2023) ==> Checking runtime dependencies... ==> Installing missing dependencies... [?25lresolving dependencies... looking for conflicting packages... warning: dependency cycle detected: warning: harfbuzz will be installed before its freetype2 dependency Package (29) New Version Net Change extra/freetype2 2.13.0-1 1.53 MiB extra/fribidi 1.0.12-1 0.20 MiB extra/graphite 1:1.3.14-3 0.17 MiB extra/harfbuzz 7.0.1-1 3.28 MiB extra/lcms2 2.14-2 0.58 MiB community/libimagequant 4.0.4-1 0.53 MiB extra/libjpeg-turbo 2.1.4-2 1.38 MiB core/libnsl 2.0.0-2 0.06 MiB extra/libpng 1.6.39-1 0.50 MiB extra/libraqm 0.10.0-1 0.16 MiB extra/libtiff 4.5.0-2 6.01 MiB extra/libxau 1.0.11-1 0.02 MiB extra/libxcb 1.15-2 3.60 MiB extra/libxdmcp 1.1.4-1 0.12 MiB extra/libyaml 0.2.5-2 0.15 MiB extra/openjpeg2 2.5.0-2 13.14 MiB core/python 3.10.9-1 81.37 MiB extra/python-markupsafe 2.1.2-1 0.06 MiB community/python-pillow 9.4.0-2 2.95 MiB community/python-zipp 3.12.0-1 0.04 MiB extra/xcb-proto 1.15.2-2 0.88 MiB community/python-docutils 1:0.19-2 4.26 MiB community/python-importlib-metadata 5.0.0-3 0.15 MiB community/python-jinja 1:3.1.2-2 1.28 MiB extra/python-packaging 23.0-1 0.32 MiB community/python-pygments 2.14.0-2 12.19 MiB community/python-reportlab 3.6.12-2 9.34 MiB community/python-smartypants 2.0.1-9 0.05 MiB community/python-yaml 6.0-1 0.68 MiB Total Installed Size: 145.00 MiB :: Proceed with installation? [Y/n] checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing libnsl... installing python... Optional dependencies for python python-setuptools python-pip sqlite [installed] mpdecimal: for decimal xz: for lzma [installed] tk: for tkinter installing python-docutils... installing python-zipp... installing python-importlib-metadata... installing python-markupsafe... installing python-jinja... Optional dependencies for python-jinja python-babel: for i18n support installing python-packaging... installing python-pygments... installing graphite... Optional dependencies for graphite graphite-docs: Documentation installing harfbuzz... Optional dependencies for harfbuzz harfbuzz-utils: utilities installing libpng... installing freetype2... installing libjpeg-turbo... Optional dependencies for libjpeg-turbo java-runtime>11: for TurboJPEG Java wrapper installing libtiff... Optional dependencies for libtiff freeglut: for using tiffgt installing lcms2... installing fribidi... installing libraqm... installing openjpeg2... installing libimagequant... installing xcb-proto... installing libxdmcp... installing libxau... installing libxcb... installing python-pillow... Optional dependencies for python-pillow libwebp: for webp images tk: for the ImageTK module python-olefile: OLE2 file support python-pyqt5: for the ImageQt module installing python-reportlab... installing python-smartypants... installing libyaml... installing python-yaml... [?25h==> Checking buildtime dependencies... ==> Installing missing dependencies... [?25lresolving dependencies... :: There are 3 providers available for java-runtime>=8: :: Repository extra 1) jre-openjdk 2) jre11-openjdk 3) jre17-openjdk Enter a number (default=1): looking for conflicting packages... Package (119) New Version Net Change Download Size extra/aom 3.6.0-1 4.43 MiB extra/avahi 0.8+22+gfd482a7-3 1.70 MiB extra/blas 3.11.0-2 0.20 MiB extra/cairo 1.17.8-2 1.33 MiB extra/cblas 3.11.0-2 0.17 MiB community/cython 0.29.33-1 7.53 MiB extra/dav1d 1.1.0-1 0.56 MiB core/dbus 1.14.6-1 0.77 MiB extra/fontconfig 2:2.14.2-1 1.00 MiB extra/gd 2.3.3-6 0.55 MiB extra/gdk-pixbuf2 2.42.10-2 2.90 MiB extra/ghostscript 10.0.0-5 37.85 MiB 15.37 MiB extra/giflib 5.2.1-2 0.22 MiB extra/gsfonts 20200910-2 3.11 MiB extra/gts 0.7.6.121130-2 0.50 MiB extra/gumbo-parser 0.10.1-2 0.36 MiB extra/http-parser 2.9.4-1 0.06 MiB extra/ijs 0.35-5 0.11 MiB extra/java-runtime-common 3-5 0.01 MiB extra/jbig2dec 0.19-1 0.12 MiB extra/jre-openjdk 19.0.2.u7-2 0.37 MiB extra/jre-openjdk-headless 19.0.2.u7-2 170.67 MiB extra/lapack 3.11.0-2 4.26 MiB community/libavif 0.11.1-1 0.29 MiB extra/libcups 1:2.4.2-6 0.74 MiB extra/libdaemon 0.14-5 0.05 MiB extra/libdatrie 0.2.13-2 0.05 MiB extra/libde265 1.0.11-1 0.57 MiB extra/libgit2 1:1.5.1-2 2.26 MiB extra/libheif 1.15.1-1 0.70 MiB extra/libice 1.1.1-1 0.33 MiB extra/libidn 1.41-1 0.75 MiB community/libmupdf 1.21.1-1 57.72 MiB extra/libnet 1:1.1.6-1 0.28 MiB extra/libpaper 2.0.10-1 0.05 MiB extra/librsvg 2:2.55.1-1 12.25 MiB extra/libsm 1.2.4-1 0.25 MiB extra/libthai 0.1.29-2 0.64 MiB extra/libwebp 1.3.0-2 0.73 MiB extra/libx11 1.8.4-1 9.84 MiB extra/libxaw 1.0.14-1 1.55 MiB extra/libxext 1.3.5-1 0.29 MiB extra/libxft 2.3.7-1 0.11 MiB extra/libxmu 1.1.4-1 0.32 MiB extra/libxpm 3.5.15-1 0.13 MiB extra/libxrender 0.9.11-1 0.08 MiB extra/libxslt 1.1.37-2 0.66 MiB extra/libxt 1.2.1-1 1.91 MiB community/libyuv r2322+3aebf69d-1 1.06 MiB core/lzo 2.10-5 0.34 MiB extra/netpbm 10.73.42-2 5.14 MiB core/nspr 4.35-1 0.67 MiB core/nss 3.88.1-1 4.04 MiB extra/pango 1:1.50.13-1 2.18 MiB extra/pixman 0.42.2-1 0.40 MiB extra/poppler-data 0.4.12-1 12.34 MiB extra/python-attrs 22.2.0-1 0.44 MiB community/python-autocommand 2.2.2-1 0.07 MiB community/python-babel 2.11.0-1 29.16 MiB extra/python-chardet 5.1.0-1 2.49 MiB community/python-cssselect2 0.7.0-1 0.14 MiB community/python-cycler 0.11.0-1 0.04 MiB community/python-dateutil 2.8.2-4 0.82 MiB community/python-exceptiongroup 1.1.0-1 0.09 MiB community/python-fastjsonschema 2.16.3-1 0.20 MiB extra/python-idna 3.4-1 0.67 MiB community/python-imagesize 1.4.1-2 0.03 MiB community/python-inflect 6.0.2-1 0.28 MiB community/python-iniconfig 2.0.0-2 0.03 MiB community/python-jaraco.context 4.3.0-1 0.03 MiB community/python-jaraco.functools 3.6.0-1 0.05 MiB community/python-jaraco.text 3.11.1-1 0.07 MiB community/python-kiwisolver 1.4.4-2 0.11 MiB extra/python-lxml 4.9.2-1 4.16 MiB community/python-more-itertools 9.0.0-1 0.49 MiB extra/python-numpy 1.24.2-1 30.13 MiB extra/python-ordered-set 4.1.0-1 0.06 MiB extra/python-platformdirs 3.0.0-1 0.12 MiB community/python-pluggy 1.0.0-2 0.10 MiB community/python-pydantic 1.10.4-1 5.81 MiB extra/python-pyparsing 3.0.9-1 0.96 MiB community/python-pyproject-hooks 1.0.0-1 0.07 MiB community/python-pytz 2022.7-1 0.14 MiB extra/python-requests 2.28.2-1 0.46 MiB extra/python-setuptools 1:67.3.3-1 3.33 MiB extra/python-six 1.16.0-6 0.09 MiB community/python-snowballstemmer 2.2.0-3 1.78 MiB community/python-sphinx-alabaster-theme 0.7.13-1 0.04 MiB community/python-sphinxcontrib-applehelp 1.0.4-1 0.25 MiB community/python-sphinxcontrib-devhelp 1.0.2-9 0.13 MiB community/python-sphinxcontrib-htmlhelp 2.0.1-1 0.16 MiB community/python-sphinxcontrib-jsmath 1.0.1-12 0.01 MiB community/python-sphinxcontrib-qthelp 1.0.3-9 0.16 MiB community/python-sphinxcontrib-serializinghtml 1.1.5-4 0.13 MiB community/python-tinycss2 1.2.1-1 0.21 MiB extra/python-tomli 2.0.1-1 0.08 MiB extra/python-trove-classifiers 2023.2.8-1 0.11 MiB community/python-typing_extensions 4.5.0-1 0.23 MiB extra/python-urllib3 1.26.7-5 0.69 MiB extra/python-validate-pyproject 0.12.1-1 0.22 MiB community/python-webencodings 0.5.1-9 0.06 MiB extra/qhull 2020.2-4 8.11 MiB extra/rav1e 0.6.3-1 4.33 MiB extra/shared-mime-info 2.2+13+ga2ffb28-1 4.51 MiB extra/svt-av1 1.4.1-1 3.34 MiB extra/x265 3.5-3 3.62 MiB extra/xorgproto 2022.2-1 1.43 MiB extra/graphviz 7.1.0-1 8.69 MiB community/plantuml 1.2022.14-1 10.82 MiB community/python-aafigure 0.6-3 0.22 MiB community/python-build 0.10.0-1 1.08 MiB community/python-installer 0.6.0-1 1.20 MiB community/python-matplotlib 3.4.3-1 21.76 MiB community/python-pymupdf 1.21.1-1 37.33 MiB community/python-pytest 7.2.1-1 2.80 MiB community/python-setuptools-scm 7.1.0-1 0.27 MiB community/python-sphinx 5.3.0-1 15.45 MiB community/python-svglib 1.5.1-1 0.22 MiB community/python-wheel 0.38.4-1 0.16 MiB Total Download Size: 15.37 MiB Total Installed Size: 567.75 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... ghostscript-10.0.0-5-riscv64 downloading... checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing python-tomli... installing python-pyproject-hooks... installing python-build... Optional dependencies for python-build python-virtualenv: Use virtualenv for build isolation installing python-installer... installing python-more-itertools... installing python-jaraco.functools... installing python-jaraco.context... installing python-autocommand... installing cython... installing python-typing_extensions... installing python-pydantic... Optional dependencies for python-pydantic python-dotenv: for .env file support python-email-validator: for email validation installing python-inflect... installing python-jaraco.text... installing python-ordered-set... installing python-platformdirs... installing python-fastjsonschema... installing python-trove-classifiers... installing python-validate-pyproject... installing python-setuptools... installing python-setuptools-scm... installing python-wheel... Optional dependencies for python-wheel python-keyring: for wheel.signatures python-xdg: for wheel.signatures installing fontconfig... Creating fontconfig configuration... Rebuilding fontconfig cache... installing libice... installing libsm... installing xorgproto... installing libx11... installing libxt... installing libxext... installing libxpm... installing giflib... installing libwebp... installing aom... installing dav1d... Optional dependencies for dav1d dav1d-doc: HTML documentation installing http-parser... installing libgit2... installing rav1e... installing svt-av1... installing libyuv... installing libavif... installing libde265... Optional dependencies for libde265 ffmpeg: for sherlock265 qt5-base: for sherlock265 sdl: dec265 YUV overlay output installing x265... installing libheif... Optional dependencies for libheif libjpeg: for heif-convert and heif-enc [installed] libpng: for heif-convert and heif-enc [installed] installing gd... Optional dependencies for gd perl: bdftogd script [installed] installing libxrender... installing lzo... installing pixman... installing cairo... installing shared-mime-info... installing gdk-pixbuf2... Optional dependencies for gdk-pixbuf2 libwmf: Load .wmf and .apm libopenraw: Load .dng, .cr2, .crw, .nef, .orf, .pef, .arw, .erf, .mrw, and .raf libavif: Load .avif [installed] libheif: Load .heif, .heic, and .avif [installed] libjxl: Load .jxl librsvg: Load .svg, .svgz, and .svg.gz [pending] webp-pixbuf-loader: Load .webp installing libdatrie... installing libthai... installing libxft... installing pango... installing librsvg... installing libxmu... installing libxaw... installing libdaemon... installing dbus... installing avahi... Optional dependencies for avahi gtk3: avahi-discover, avahi-discover-standalone, bshell, bssh, bvnc qt5-base: qt5 bindings libevent: libevent bindings [installed] nss-mdns: NSS support for mDNS python-twisted: avahi-bookmarks python-gobject: avahi-bookmarks, avahi-discover python-dbus: avahi-bookmarks, avahi-discover installing libcups... installing jbig2dec... installing libpaper... installing ijs... installing libidn... installing poppler-data... installing ghostscript... Optional dependencies for ghostscript texlive-core: needed for dvipdf gtk3: needed for gsx installing netpbm... installing gts... installing gsfonts... installing graphviz... Warning: Could not load "/usr/lib/graphviz/libgvplugin_gdk.so.6" - It was found, so perhaps one of its dependents was not. Try ldd. Warning: Could not load "/usr/lib/graphviz/libgvplugin_gtk.so.6" - It was found, so perhaps one of its dependents was not. Try ldd. Warning: Could not load "/usr/lib/graphviz/libgvplugin_gdk.so.6" - It was found, so perhaps one of its dependents was not. Try ldd. Warning: Could not load "/usr/lib/graphviz/libgvplugin_gtk.so.6" - It was found, so perhaps one of its dependents was not. Try ldd. Optional dependencies for graphviz mono: sharp bindings guile: guile bindings [installed] lua: lua bindings ocaml: ocaml bindings perl: perl bindings [installed] python: python bindings [installed] r: r bindings tcl: tcl bindings qt5-base: gvedit gtk2: gtk output plugin xterm: vimdot installing java-runtime-common... For the complete set of Java binaries to be available in your PATH, you need to re-login or source /etc/profile.d/jre.sh Please note that this package does not support forcing JAVA_HOME as former package java-common did installing nspr... installing nss... installing libnet... installing jre-openjdk-headless... Optional dependencies for jre-openjdk-headless java-rhino: for some JavaScript support installing jre-openjdk... when you use a non-reparenting window manager, set _JAVA_AWT_WM_NONREPARENTING=1 in /etc/profile.d/jre.sh Optional dependencies for jre-openjdk alsa-lib: for basic sound support gtk2: for the Gtk+ 2 look and feel - desktop usage gtk3: for the Gtk+ 3 look and feel - desktop usage installing plantuml... Optional dependencies for plantuml plantuml-ascii-math: allow use AsciiMath or JLaTeXMath notation ditaa: allow use ditaa notation graphviz: allow use Graphviz/DOT notation [installed] installing python-aafigure... installing python-six... installing python-cycler... installing python-dateutil... installing python-kiwisolver... installing blas... installing cblas... installing lapack... installing python-numpy... Optional dependencies for python-numpy openblas: faster linear algebra installing python-pyparsing... Optional dependencies for python-pyparsing python-railroad-diagrams: for generating Railroad Diagrams python-jinja: for generating Railroad Diagrams [installed] installing qhull... installing python-matplotlib... Optional dependencies for python-matplotlib tk: Tk{Agg,Cairo} backends pyside2: alternative for Qt5{Agg,Cairo} backends python-pyqt5: Qt5{Agg,Cairo} backends python-gobject: for GTK3{Agg,Cairo} backend python-wxpython: WX{,Agg,Cairo} backend python-cairo: {GTK3,Qt5,Tk,WX}Cairo backends python-cairocffi: alternative for Cairo backends python-tornado: WebAgg backend ffmpeg: for saving movies imagemagick: for saving animated gifs ghostscript: usetex dependencies [installed] texlive-bin: usetex dependencies texlive-latexextra: usetex usage with pdflatex python-certifi: https support installing python-attrs... installing python-exceptiongroup... installing python-iniconfig... installing python-pluggy... installing python-pytest... installing gumbo-parser... installing libmupdf... installing python-pymupdf... Optional dependencies for python-pymupdf python-fonttools: for building font subsets using fontTools python-pillow: for image file saving using pillow [installed] installing python-pytz... installing python-babel... installing python-imagesize... installing python-urllib3... Optional dependencies for python-urllib3 python-pysocks: SOCKS support python-brotli: Brotli support python-pyopenssl: security support python-idna: security support [pending] installing python-chardet... installing python-idna... installing python-requests... Optional dependencies for python-requests python-pysocks: SOCKS proxy support installing python-snowballstemmer... Optional dependencies for python-snowballstemmer python-pystemmer: for improved performance installing python-sphinx-alabaster-theme... installing python-sphinxcontrib-applehelp... installing python-sphinxcontrib-devhelp... installing python-sphinxcontrib-htmlhelp... installing python-sphinxcontrib-jsmath... installing python-sphinxcontrib-qthelp... installing python-sphinxcontrib-serializinghtml... installing python-sphinx... Optional dependencies for python-sphinx imagemagick: for ext.imgconverter texlive-latexextra: for generation of PDF documentation installing libxslt... Optional dependencies for libxslt python: Python bindings [installed] installing python-lxml... Optional dependencies for python-lxml python-beautifulsoup4: support for beautifulsoup parser to parse not well formed HTML python-cssselect: support for cssselect python-html5lib: support for html5lib parser python-lxml-docs: offline docs installing python-webencodings... installing python-tinycss2... installing python-cssselect2... installing python-svglib... :: Running post-transaction hooks... (1/7) Updating the MIME type database... (2/7) Updating fontconfig configuration... (3/7) Reloading system bus configuration... call to execv failed (No such file or directory) error: command failed to execute correctly (4/7) Warn about old perl modules (5/7) Updating fontconfig cache... (6/7) Probing GDK-Pixbuf loader modules... (7/7) Updating the info directory file... [?25h==> Retrieving sources...  -> Found rst2pdf-0.99.tar.gz ==> WARNING: Skipping all source file integrity checks. ==> Extracting sources...  -> Extracting rst2pdf-0.99.tar.gz with bsdtar ==> Starting build()... * Getting build dependencies for wheel... running egg_info creating rst2pdf.egg-info writing rst2pdf.egg-info/PKG-INFO writing dependency_links to rst2pdf.egg-info/dependency_links.txt writing entry points to rst2pdf.egg-info/entry_points.txt writing requirements to rst2pdf.egg-info/requires.txt writing top-level names to rst2pdf.egg-info/top_level.txt writing manifest file 'rst2pdf.egg-info/SOURCES.txt' reading manifest file 'rst2pdf.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE.txt' writing manifest file 'rst2pdf.egg-info/SOURCES.txt' * Building wheel... running bdist_wheel running build running build_py creating build creating build/lib creating build/lib/rst2pdf copying ./rst2pdf/__init__.py -> build/lib/rst2pdf copying ./rst2pdf/basenodehandler.py -> build/lib/rst2pdf copying ./rst2pdf/config.py -> build/lib/rst2pdf copying ./rst2pdf/createpdf.py -> build/lib/rst2pdf copying ./rst2pdf/dumpstyle.py -> build/lib/rst2pdf copying ./rst2pdf/findfonts.py -> build/lib/rst2pdf copying ./rst2pdf/flowables.py -> build/lib/rst2pdf copying ./rst2pdf/genelements.py -> build/lib/rst2pdf copying ./rst2pdf/genpdftext.py -> build/lib/rst2pdf copying ./rst2pdf/image.py -> build/lib/rst2pdf copying ./rst2pdf/languages.py -> build/lib/rst2pdf copying ./rst2pdf/log.py -> build/lib/rst2pdf copying ./rst2pdf/math_flowable.py -> build/lib/rst2pdf copying ./rst2pdf/nodehandlers.py -> build/lib/rst2pdf copying ./rst2pdf/pdfbuilder.py -> build/lib/rst2pdf copying ./rst2pdf/pygments2style.py -> build/lib/rst2pdf copying ./rst2pdf/rson.py -> build/lib/rst2pdf copying ./rst2pdf/sectnumlinks.py -> build/lib/rst2pdf copying ./rst2pdf/sinker.py -> build/lib/rst2pdf copying ./rst2pdf/sphinxnodes.py -> build/lib/rst2pdf copying ./rst2pdf/style2yaml.py -> build/lib/rst2pdf copying ./rst2pdf/styles.py -> build/lib/rst2pdf copying ./rst2pdf/svgimage.py -> build/lib/rst2pdf copying ./rst2pdf/utils.py -> build/lib/rst2pdf copying ./rst2pdf/writer.py -> build/lib/rst2pdf creating build/lib/rst2pdf/directives copying ./rst2pdf/directives/__init__.py -> build/lib/rst2pdf/directives copying ./rst2pdf/directives/aafigure.py -> build/lib/rst2pdf/directives copying ./rst2pdf/directives/code_block.py -> build/lib/rst2pdf/directives copying ./rst2pdf/directives/contents.py -> build/lib/rst2pdf/directives copying ./rst2pdf/directives/noop.py -> build/lib/rst2pdf/directives copying ./rst2pdf/directives/oddeven.py -> build/lib/rst2pdf/directives creating build/lib/rst2pdf/extensions copying ./rst2pdf/extensions/__init__.py -> build/lib/rst2pdf/extensions copying ./rst2pdf/extensions/dotted_toc.py -> build/lib/rst2pdf/extensions copying ./rst2pdf/extensions/fancytitles.py -> build/lib/rst2pdf/extensions copying ./rst2pdf/extensions/plantuml_r2p.py -> build/lib/rst2pdf/extensions copying ./rst2pdf/extensions/preprocess_r2p.py -> build/lib/rst2pdf/extensions copying ./rst2pdf/extensions/sample.py -> build/lib/rst2pdf/extensions creating build/lib/rst2pdf/roles copying ./rst2pdf/roles/__init__.py -> build/lib/rst2pdf/roles copying ./rst2pdf/roles/counter.py -> build/lib/rst2pdf/roles copying ./rst2pdf/roles/counter_off.py -> build/lib/rst2pdf/roles copying ./rst2pdf/roles/package.py -> build/lib/rst2pdf/roles creating build/lib/rst2pdf/styles copying ./rst2pdf/styles/11x17.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a0.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a1-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a1.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a2-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a2.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a3-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a3.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a4-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a4.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a5-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a5.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a6-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/a6.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/abap.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/algol.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/algol_nu.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/arduino.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/autumn.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b0.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b1-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b1.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b2-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b2.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b3-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b3.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b4-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b4.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b5-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b5.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b6-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/b6.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/borland.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/bw.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/colorful.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/debugtables.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/default.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/dejavu.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/double-sided.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/eightpoint.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/emacs.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/freetype-sans.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/freetype-serif.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/friendly.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/fruity.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/igor.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/legal.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/letter-landscape.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/letter.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/lovelace.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/manni.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/monokai.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/murphy.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/native.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/no-compact-lists.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/paraiso-dark.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/paraiso-light.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/pastie.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/perldoc.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/rainbow_dash.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/rrt.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/rst2pdf-0-9.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/sas.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/serif.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/solarized-dark.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/solarized-light.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/sphinx.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/stata-dark.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/stata-light.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/stata.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/styles.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/tango.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/tenpoint.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/trac.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/twelvepoint.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/twocolumn.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/vim.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/vs.yaml -> build/lib/rst2pdf/styles copying ./rst2pdf/styles/xcode.yaml -> build/lib/rst2pdf/styles creating build/lib/rst2pdf/images copying ./rst2pdf/images/image-missing.png -> build/lib/rst2pdf/images copying ./rst2pdf/images/image-missing.jpg -> build/lib/rst2pdf/images creating build/lib/rst2pdf/templates copying ./rst2pdf/templates/cover.tmpl -> build/lib/rst2pdf/templates copying ./rst2pdf/templates/sphinxcover.tmpl -> build/lib/rst2pdf/templates installing to build/bdist.linux-riscv64/wheel running install running install_lib creating build/bdist.linux-riscv64 creating build/bdist.linux-riscv64/wheel creating build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/__init__.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/basenodehandler.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/config.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/createpdf.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/dumpstyle.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/findfonts.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/flowables.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/genelements.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/genpdftext.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/image.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/languages.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/log.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/math_flowable.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/nodehandlers.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/pdfbuilder.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/pygments2style.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/rson.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/sectnumlinks.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/sinker.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/sphinxnodes.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/style2yaml.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/styles.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/svgimage.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/utils.py -> build/bdist.linux-riscv64/wheel/rst2pdf copying build/lib/rst2pdf/writer.py -> build/bdist.linux-riscv64/wheel/rst2pdf creating build/bdist.linux-riscv64/wheel/rst2pdf/directives copying build/lib/rst2pdf/directives/__init__.py -> build/bdist.linux-riscv64/wheel/rst2pdf/directives copying build/lib/rst2pdf/directives/aafigure.py -> build/bdist.linux-riscv64/wheel/rst2pdf/directives copying build/lib/rst2pdf/directives/code_block.py -> build/bdist.linux-riscv64/wheel/rst2pdf/directives copying build/lib/rst2pdf/directives/contents.py -> build/bdist.linux-riscv64/wheel/rst2pdf/directives copying build/lib/rst2pdf/directives/noop.py -> build/bdist.linux-riscv64/wheel/rst2pdf/directives copying build/lib/rst2pdf/directives/oddeven.py -> build/bdist.linux-riscv64/wheel/rst2pdf/directives creating build/bdist.linux-riscv64/wheel/rst2pdf/extensions copying build/lib/rst2pdf/extensions/__init__.py -> build/bdist.linux-riscv64/wheel/rst2pdf/extensions copying build/lib/rst2pdf/extensions/dotted_toc.py -> build/bdist.linux-riscv64/wheel/rst2pdf/extensions copying build/lib/rst2pdf/extensions/fancytitles.py -> build/bdist.linux-riscv64/wheel/rst2pdf/extensions copying build/lib/rst2pdf/extensions/plantuml_r2p.py -> build/bdist.linux-riscv64/wheel/rst2pdf/extensions copying build/lib/rst2pdf/extensions/preprocess_r2p.py -> build/bdist.linux-riscv64/wheel/rst2pdf/extensions copying build/lib/rst2pdf/extensions/sample.py -> build/bdist.linux-riscv64/wheel/rst2pdf/extensions creating build/bdist.linux-riscv64/wheel/rst2pdf/roles copying build/lib/rst2pdf/roles/__init__.py -> build/bdist.linux-riscv64/wheel/rst2pdf/roles copying build/lib/rst2pdf/roles/counter.py -> build/bdist.linux-riscv64/wheel/rst2pdf/roles copying build/lib/rst2pdf/roles/counter_off.py -> build/bdist.linux-riscv64/wheel/rst2pdf/roles copying build/lib/rst2pdf/roles/package.py -> build/bdist.linux-riscv64/wheel/rst2pdf/roles creating build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/11x17.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a0.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a1-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a1.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a2-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a2.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a3-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a3.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a4-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a4.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a5-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a5.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a6-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/a6.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/abap.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/algol.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/algol_nu.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/arduino.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/autumn.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b0.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b1-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b1.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b2-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b2.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b3-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b3.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b4-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b4.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b5-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b5.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b6-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/b6.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/borland.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/bw.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/colorful.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/debugtables.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/default.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/dejavu.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/double-sided.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/eightpoint.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/emacs.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/freetype-sans.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/freetype-serif.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/friendly.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/fruity.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/igor.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/legal.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/letter-landscape.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/letter.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/lovelace.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/manni.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/monokai.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/murphy.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/native.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/no-compact-lists.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/paraiso-dark.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/paraiso-light.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/pastie.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/perldoc.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/rainbow_dash.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/rrt.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/rst2pdf-0-9.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/sas.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/serif.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/solarized-dark.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/solarized-light.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/sphinx.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/stata-dark.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/stata-light.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/stata.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/styles.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/tango.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/tenpoint.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/trac.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/twelvepoint.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/twocolumn.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/vim.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/vs.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles copying build/lib/rst2pdf/styles/xcode.yaml -> build/bdist.linux-riscv64/wheel/rst2pdf/styles creating build/bdist.linux-riscv64/wheel/rst2pdf/images copying build/lib/rst2pdf/images/image-missing.png -> build/bdist.linux-riscv64/wheel/rst2pdf/images copying build/lib/rst2pdf/images/image-missing.jpg -> build/bdist.linux-riscv64/wheel/rst2pdf/images creating build/bdist.linux-riscv64/wheel/rst2pdf/templates copying build/lib/rst2pdf/templates/cover.tmpl -> build/bdist.linux-riscv64/wheel/rst2pdf/templates copying build/lib/rst2pdf/templates/sphinxcover.tmpl -> build/bdist.linux-riscv64/wheel/rst2pdf/templates running install_egg_info running egg_info writing rst2pdf.egg-info/PKG-INFO writing dependency_links to rst2pdf.egg-info/dependency_links.txt writing entry points to rst2pdf.egg-info/entry_points.txt writing requirements to rst2pdf.egg-info/requires.txt writing top-level names to rst2pdf.egg-info/top_level.txt reading manifest file 'rst2pdf.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE.txt' writing manifest file 'rst2pdf.egg-info/SOURCES.txt' Copying rst2pdf.egg-info to build/bdist.linux-riscv64/wheel/rst2pdf-0.99-py3.10.egg-info running install_scripts creating build/bdist.linux-riscv64/wheel/rst2pdf-0.99.dist-info/WHEEL creating '/build/rst2pdf/src/rst2pdf-0.99/dist/.tmp-aus_ytpo/rst2pdf-0.99-py3-none-any.whl' and adding 'build/bdist.linux-riscv64/wheel' to it adding 'rst2pdf/__init__.py' adding 'rst2pdf/basenodehandler.py' adding 'rst2pdf/config.py' adding 'rst2pdf/createpdf.py' adding 'rst2pdf/dumpstyle.py' adding 'rst2pdf/findfonts.py' adding 'rst2pdf/flowables.py' adding 'rst2pdf/genelements.py' adding 'rst2pdf/genpdftext.py' adding 'rst2pdf/image.py' adding 'rst2pdf/languages.py' adding 'rst2pdf/log.py' adding 'rst2pdf/math_flowable.py' adding 'rst2pdf/nodehandlers.py' adding 'rst2pdf/pdfbuilder.py' adding 'rst2pdf/pygments2style.py' adding 'rst2pdf/rson.py' adding 'rst2pdf/sectnumlinks.py' adding 'rst2pdf/sinker.py' adding 'rst2pdf/sphinxnodes.py' adding 'rst2pdf/style2yaml.py' adding 'rst2pdf/styles.py' adding 'rst2pdf/svgimage.py' adding 'rst2pdf/utils.py' adding 'rst2pdf/writer.py' adding 'rst2pdf/directives/__init__.py' adding 'rst2pdf/directives/aafigure.py' adding 'rst2pdf/directives/code_block.py' adding 'rst2pdf/directives/contents.py' adding 'rst2pdf/directives/noop.py' adding 'rst2pdf/directives/oddeven.py' adding 'rst2pdf/extensions/__init__.py' adding 'rst2pdf/extensions/dotted_toc.py' adding 'rst2pdf/extensions/fancytitles.py' adding 'rst2pdf/extensions/plantuml_r2p.py' adding 'rst2pdf/extensions/preprocess_r2p.py' adding 'rst2pdf/extensions/sample.py' adding 'rst2pdf/images/image-missing.jpg' adding 'rst2pdf/images/image-missing.png' adding 'rst2pdf/roles/__init__.py' adding 'rst2pdf/roles/counter.py' adding 'rst2pdf/roles/counter_off.py' adding 'rst2pdf/roles/package.py' adding 'rst2pdf/styles/11x17.yaml' adding 'rst2pdf/styles/a0.yaml' adding 'rst2pdf/styles/a1-landscape.yaml' adding 'rst2pdf/styles/a1.yaml' adding 'rst2pdf/styles/a2-landscape.yaml' adding 'rst2pdf/styles/a2.yaml' adding 'rst2pdf/styles/a3-landscape.yaml' adding 'rst2pdf/styles/a3.yaml' adding 'rst2pdf/styles/a4-landscape.yaml' adding 'rst2pdf/styles/a4.yaml' adding 'rst2pdf/styles/a5-landscape.yaml' adding 'rst2pdf/styles/a5.yaml' adding 'rst2pdf/styles/a6-landscape.yaml' adding 'rst2pdf/styles/a6.yaml' adding 'rst2pdf/styles/abap.yaml' adding 'rst2pdf/styles/algol.yaml' adding 'rst2pdf/styles/algol_nu.yaml' adding 'rst2pdf/styles/arduino.yaml' adding 'rst2pdf/styles/autumn.yaml' adding 'rst2pdf/styles/b0.yaml' adding 'rst2pdf/styles/b1-landscape.yaml' adding 'rst2pdf/styles/b1.yaml' adding 'rst2pdf/styles/b2-landscape.yaml' adding 'rst2pdf/styles/b2.yaml' adding 'rst2pdf/styles/b3-landscape.yaml' adding 'rst2pdf/styles/b3.yaml' adding 'rst2pdf/styles/b4-landscape.yaml' adding 'rst2pdf/styles/b4.yaml' adding 'rst2pdf/styles/b5-landscape.yaml' adding 'rst2pdf/styles/b5.yaml' adding 'rst2pdf/styles/b6-landscape.yaml' adding 'rst2pdf/styles/b6.yaml' adding 'rst2pdf/styles/borland.yaml' adding 'rst2pdf/styles/bw.yaml' adding 'rst2pdf/styles/colorful.yaml' adding 'rst2pdf/styles/debugtables.yaml' adding 'rst2pdf/styles/default.yaml' adding 'rst2pdf/styles/dejavu.yaml' adding 'rst2pdf/styles/double-sided.yaml' adding 'rst2pdf/styles/eightpoint.yaml' adding 'rst2pdf/styles/emacs.yaml' adding 'rst2pdf/styles/freetype-sans.yaml' adding 'rst2pdf/styles/freetype-serif.yaml' adding 'rst2pdf/styles/friendly.yaml' adding 'rst2pdf/styles/fruity.yaml' adding 'rst2pdf/styles/igor.yaml' adding 'rst2pdf/styles/legal.yaml' adding 'rst2pdf/styles/letter-landscape.yaml' adding 'rst2pdf/styles/letter.yaml' adding 'rst2pdf/styles/lovelace.yaml' adding 'rst2pdf/styles/manni.yaml' adding 'rst2pdf/styles/monokai.yaml' adding 'rst2pdf/styles/murphy.yaml' adding 'rst2pdf/styles/native.yaml' adding 'rst2pdf/styles/no-compact-lists.yaml' adding 'rst2pdf/styles/paraiso-dark.yaml' adding 'rst2pdf/styles/paraiso-light.yaml' adding 'rst2pdf/styles/pastie.yaml' adding 'rst2pdf/styles/perldoc.yaml' adding 'rst2pdf/styles/rainbow_dash.yaml' adding 'rst2pdf/styles/rrt.yaml' adding 'rst2pdf/styles/rst2pdf-0-9.yaml' adding 'rst2pdf/styles/sas.yaml' adding 'rst2pdf/styles/serif.yaml' adding 'rst2pdf/styles/solarized-dark.yaml' adding 'rst2pdf/styles/solarized-light.yaml' adding 'rst2pdf/styles/sphinx.yaml' adding 'rst2pdf/styles/stata-dark.yaml' adding 'rst2pdf/styles/stata-light.yaml' adding 'rst2pdf/styles/stata.yaml' adding 'rst2pdf/styles/styles.yaml' adding 'rst2pdf/styles/tango.yaml' adding 'rst2pdf/styles/tenpoint.yaml' adding 'rst2pdf/styles/trac.yaml' adding 'rst2pdf/styles/twelvepoint.yaml' adding 'rst2pdf/styles/twocolumn.yaml' adding 'rst2pdf/styles/vim.yaml' adding 'rst2pdf/styles/vs.yaml' adding 'rst2pdf/styles/xcode.yaml' adding 'rst2pdf/templates/cover.tmpl' adding 'rst2pdf/templates/sphinxcover.tmpl' adding 'rst2pdf-0.99.dist-info/LICENSE.txt' adding 'rst2pdf-0.99.dist-info/METADATA' adding 'rst2pdf-0.99.dist-info/WHEEL' adding 'rst2pdf-0.99.dist-info/entry_points.txt' adding 'rst2pdf-0.99.dist-info/top_level.txt' adding 'rst2pdf-0.99.dist-info/RECORD' removing build/bdist.linux-riscv64/wheel Successfully built rst2pdf-0.99-py3-none-any.whl ==> Starting check()... mkdir: created directory 'test_dir' ============================= test session starts ============================== platform linux -- Python 3.10.9, pytest-7.2.1, pluggy-1.0.0 -- /usr/bin/python cachedir: .pytest_cache rootdir: /build/rst2pdf/src/rst2pdf-0.99 collecting ... collected 313 items / 17 deselected / 296 selected rst2pdf/tests/input/invalid_cli_flag.rst::invalid_cli_flag PASSED [ 0%] rst2pdf/tests/input/numbered_links.rst::numbered_links FAILED [ 0%] rst2pdf/tests/input/numbered_links_2.rst::numbered_links_2 FAILED [ 1%] rst2pdf/tests/input/source.rst::source FAILED [ 1%] rst2pdf/tests/input/styled_literal.rst::styled_literal FAILED [ 1%] rst2pdf/tests/input/test-referencing-an-aliased-font.rst::test-referencing-an-aliased-font FAILED [ 2%] rst2pdf/tests/input/test_753.rst::test_753 FAILED [ 2%] rst2pdf/tests/input/test_aafigure.rst::test_aafigure FAILED [ 2%] rst2pdf/tests/input/test_aafigure_extra.rst::test_aafigure_extra FAILED [ 3%] rst2pdf/tests/input/test_alignment_of_figures_and_images.rst::test_alignment_of_figures_and_images FAILED [ 3%] rst2pdf/tests/input/test_autoembedding_type1.rst::test_autoembedding_type1 FAILED [ 3%] rst2pdf/tests/input/test_autoleading.rst::test_autoleading FAILED [ 4%] rst2pdf/tests/input/test_background.rst::test_background FAILED [ 4%] rst2pdf/tests/input/test_background_image.rst::test_background_image FAILED [ 4%] rst2pdf/tests/input/test_background_svg.rst::test_background_svg FAILED [ 5%] rst2pdf/tests/input/test_base_url.rst::test_base_url FAILED [ 5%] rst2pdf/tests/input/test_blockquotes_in_table.rst::test_blockquotes_in_table FAILED [ 5%] rst2pdf/tests/input/test_bullet_chars.rst::test_bullet_chars FAILED [ 6%] rst2pdf/tests/input/test_bullet_widths.rst::test_bullet_widths FAILED [ 6%] rst2pdf/tests/input/test_codeblock_tabs.rst::test_codeblock_tabs FAILED [ 6%] rst2pdf/tests/input/test_cover.rst::test_cover FAILED [ 7%] rst2pdf/tests/input/test_cover_2.rst::test_cover_2 FAILED [ 7%] rst2pdf/tests/input/test_cover_3.rst::test_cover_3 FAILED [ 7%] rst2pdf/tests/input/test_csv_table.rst::test_csv_table FAILED [ 8%] rst2pdf/tests/input/test_custom_cover.rst::test_custom_cover FAILED [ 8%] rst2pdf/tests/input/test_definition_lists.rst::test_definition_lists FAILED [ 8%] rst2pdf/tests/input/test_dict_styles.rst::test_dict_styles FAILED [ 9%] rst2pdf/tests/input/test_docutils_math.rst::test_docutils_math FAILED [ 9%] rst2pdf/tests/input/test_embedded_reference.rst::test_embedded_reference FAILED [ 9%] rst2pdf/tests/input/test_extensions.rst::test_extensions FAILED [ 10%] rst2pdf/tests/input/test_field_widths.rst::test_field_widths FAILED [ 10%] rst2pdf/tests/input/test_figure_alignment.rst::test_figure_alignment FAILED [ 10%] rst2pdf/tests/input/test_fontsizeunits.rst::test_fontsizeunits FAILED [ 11%] rst2pdf/tests/input/test_footnotes.rst::test_footnotes FAILED [ 11%] rst2pdf/tests/input/test_foreground.rst::test_foreground FAILED [ 11%] rst2pdf/tests/input/test_framebreak.rst::test_framebreak FAILED [ 12%] rst2pdf/tests/input/test_greek.rst::test_greek FAILED [ 12%] rst2pdf/tests/input/test_header_footer.rst::test_header_footer FAILED [ 12%] rst2pdf/tests/input/test_header_separator.rst::test_header_separator FAILED [ 13%] rst2pdf/tests/input/test_hl_lines.rst::test_hl_lines FAILED [ 13%] rst2pdf/tests/input/test_image_alignment.rst::test_image_alignment FAILED [ 13%] rst2pdf/tests/input/test_image_directive.rst::test_image_directive FAILED [ 14%] rst2pdf/tests/input/test_image_units.rst::test_image_units FAILED [ 14%] rst2pdf/tests/input/test_image_units_svg.rst::test_image_units_svg SKIPPED (Sizes of SVG images are incorrect. They are too small.) [ 14%] rst2pdf/tests/input/test_img_header.rst::test_img_header FAILED [ 15%] rst2pdf/tests/input/test_inline_colors.rst::test_inline_colors FAILED [ 15%] rst2pdf/tests/input/test_inline_image.rst::test_inline_image FAILED [ 15%] rst2pdf/tests/input/test_internal_link.rst::test_internal_link FAILED [ 16%] rst2pdf/tests/input/test_issue_103.rst::test_issue_103 FAILED [ 16%] rst2pdf/tests/input/test_issue_104.rst::test_issue_104 FAILED [ 16%] rst2pdf/tests/input/test_issue_107.rst::test_issue_107 FAILED [ 17%] rst2pdf/tests/input/test_issue_109.rst::test_issue_109 FAILED [ 17%] rst2pdf/tests/input/test_issue_112.rst::test_issue_112 FAILED [ 17%] rst2pdf/tests/input/test_issue_113.rst::test_issue_113 FAILED [ 18%] rst2pdf/tests/input/test_issue_114.rst::test_issue_114 FAILED [ 18%] rst2pdf/tests/input/test_issue_116.rst::test_issue_116 FAILED [ 18%] rst2pdf/tests/input/test_issue_117.rst::test_issue_117 FAILED [ 19%] rst2pdf/tests/input/test_issue_118.rst::test_issue_118 FAILED [ 19%] rst2pdf/tests/input/test_issue_118_2.rst::test_issue_118_2 FAILED [ 19%] rst2pdf/tests/input/test_issue_118_3.rst::test_issue_118_3 FAILED [ 20%] rst2pdf/tests/input/test_issue_119.rst::test_issue_119 FAILED [ 20%] rst2pdf/tests/input/test_issue_128.rst::test_issue_128 FAILED [ 20%] rst2pdf/tests/input/test_issue_132.rst::test_issue_132 FAILED [ 21%] rst2pdf/tests/input/test_issue_134.rst::test_issue_134 FAILED [ 21%] rst2pdf/tests/input/test_issue_137.rst::test_issue_137 FAILED [ 21%] rst2pdf/tests/input/test_issue_138.rst::test_issue_138 FAILED [ 22%] rst2pdf/tests/input/test_issue_140.rst::test_issue_140 FAILED [ 22%] rst2pdf/tests/input/test_issue_143.rst::test_issue_143 FAILED [ 22%] rst2pdf/tests/input/test_issue_144.rst::test_issue_144 FAILED [ 23%] rst2pdf/tests/input/test_issue_146.rst::test_issue_146 FAILED [ 23%] rst2pdf/tests/input/test_issue_147.rst::test_issue_147 FAILED [ 23%] rst2pdf/tests/input/test_issue_151.rst::test_issue_151 FAILED [ 24%] rst2pdf/tests/input/test_issue_152.rst::test_issue_152 FAILED [ 24%] rst2pdf/tests/input/test_issue_154.rst::test_issue_154 FAILED [ 25%] rst2pdf/tests/input/test_issue_155.rst::test_issue_155 FAILED [ 25%] rst2pdf/tests/input/test_issue_156.rst::test_issue_156 FAILED [ 25%] rst2pdf/tests/input/test_issue_159.rst::test_issue_159 FAILED [ 26%] rst2pdf/tests/input/test_issue_165.rst::test_issue_165 FAILED [ 26%] rst2pdf/tests/input/test_issue_173.rst::test_issue_173 FAILED [ 26%] rst2pdf/tests/input/test_issue_174.rst::test_issue_174 FAILED [ 27%] rst2pdf/tests/input/test_issue_175.rst::test_issue_175 FAILED [ 27%] rst2pdf/tests/input/test_issue_176.rst::test_issue_176 FAILED [ 27%] rst2pdf/tests/input/test_issue_180_1.rst::test_issue_180_1 FAILED [ 28%] rst2pdf/tests/input/test_issue_180_2.rst::test_issue_180_2 FAILED [ 28%] rst2pdf/tests/input/test_issue_181.rst::test_issue_181 FAILED [ 28%] rst2pdf/tests/input/test_issue_186.rst::test_issue_186 FAILED [ 29%] rst2pdf/tests/input/test_issue_186_2.rst::test_issue_186_2 FAILED [ 29%] rst2pdf/tests/input/test_issue_186_3.rst::test_issue_186_3 FAILED [ 29%] rst2pdf/tests/input/test_issue_196.rst::test_issue_196 FAILED [ 30%] rst2pdf/tests/input/test_issue_197.rst::test_issue_197 FAILED [ 30%] rst2pdf/tests/input/test_issue_199.rst::test_issue_199 FAILED [ 30%] rst2pdf/tests/input/test_issue_200.rst::test_issue_200 FAILED [ 31%] rst2pdf/tests/input/test_issue_201.rst::test_issue_201 FAILED [ 31%] rst2pdf/tests/input/test_issue_202.rst::test_issue_202 FAILED [ 31%] rst2pdf/tests/input/test_issue_203.rst::test_issue_203 FAILED [ 32%] rst2pdf/tests/input/test_issue_216.rst::test_issue_216 SKIPPED (Output PDF is incorrect.) [ 32%] rst2pdf/tests/input/test_issue_217.rst::test_issue_217 FAILED [ 32%] rst2pdf/tests/input/test_issue_223.rst::test_issue_223 FAILED [ 33%] rst2pdf/tests/input/test_issue_224.rst::test_issue_224 FAILED [ 33%] rst2pdf/tests/input/test_issue_225.rst::test_issue_225 FAILED [ 33%] rst2pdf/tests/input/test_issue_226.rst::test_issue_226 FAILED [ 34%] rst2pdf/tests/input/test_issue_227.rst::test_issue_227 FAILED [ 34%] rst2pdf/tests/input/test_issue_230.rst::test_issue_230 FAILED [ 34%] rst2pdf/tests/input/test_issue_231.rst::test_issue_231 FAILED [ 35%] rst2pdf/tests/input/test_issue_232.rst::test_issue_232 FAILED [ 35%] rst2pdf/tests/input/test_issue_234.rst::test_issue_234 FAILED [ 35%] rst2pdf/tests/input/test_issue_238.rst::test_issue_238 FAILED [ 36%] rst2pdf/tests/input/test_issue_239.rst::test_issue_239 SKIPPED (SVGIMage is backend, but cannot load warning.svg: [ERROR] image.py:187 Couldn't load image [/Users/rob/Projects/python/rst2pdf/rst2pdf/tests/input/warning.svg]) [ 36%] rst2pdf/tests/input/test_issue_241.rst::test_issue_241 FAILED [ 36%] rst2pdf/tests/input/test_issue_243.rst::test_issue_243 FAILED [ 37%] rst2pdf/tests/input/test_issue_244.rst::test_issue_244 FAILED [ 37%] rst2pdf/tests/input/test_issue_247.rst::test_issue_247 PASSED [ 37%] rst2pdf/tests/input/test_issue_248.rst::test_issue_248 FAILED [ 38%] rst2pdf/tests/input/test_issue_249.rst::test_issue_249 FAILED [ 38%] rst2pdf/tests/input/test_issue_255_2.rst::test_issue_255_2 SKIPPED (headers have keeptogether attribute set, however if the next item is a table, then the headers do not keep with it. Believed to be a ReportLab bug.) [ 38%] rst2pdf/tests/input/test_issue_264.rst::test_issue_264 FAILED [ 39%] rst2pdf/tests/input/test_issue_266_2.rst::test_issue_266_2 SKIPPED (Incorrect image) [ 39%] rst2pdf/tests/input/test_issue_274.rst::test_issue_274 FAILED [ 39%] rst2pdf/tests/input/test_issue_277.rst::test_issue_277 FAILED [ 40%] rst2pdf/tests/input/test_issue_277_2.rst::test_issue_277_2 FAILED [ 40%] rst2pdf/tests/input/test_issue_286.rst::test_issue_286 SKIPPED [ 40%] rst2pdf/tests/input/test_issue_289.rst::test_issue_289 SKIPPED (Vertical spacing and bullet styling issues. The reference pdf also has issues.) [ 41%] rst2pdf/tests/input/test_issue_290.rst::test_issue_290 FAILED [ 41%] rst2pdf/tests/input/test_issue_291.rst::test_issue_291 FAILED [ 41%] rst2pdf/tests/input/test_issue_292.rst::test_issue_292 FAILED [ 42%] rst2pdf/tests/input/test_issue_293.rst::test_issue_293 FAILED [ 42%] rst2pdf/tests/input/test_issue_297.rst::test_issue_297 FAILED [ 42%] rst2pdf/tests/input/test_issue_298.rst::test_issue_298 FAILED [ 43%] rst2pdf/tests/input/test_issue_299.rst::test_issue_299 FAILED [ 43%] rst2pdf/tests/input/test_issue_301.rst::test_issue_301 FAILED [ 43%] rst2pdf/tests/input/test_issue_302.rst::test_issue_302 FAILED [ 44%] rst2pdf/tests/input/test_issue_303.rst::test_issue_303 SKIPPED [ 44%] rst2pdf/tests/input/test_issue_304.rst::test_issue_304 FAILED [ 44%] rst2pdf/tests/input/test_issue_305.rst::test_issue_305 FAILED [ 45%] rst2pdf/tests/input/test_issue_307.rst::test_issue_307 FAILED [ 45%] rst2pdf/tests/input/test_issue_309.rst::test_issue_309 FAILED [ 45%] rst2pdf/tests/input/test_issue_310.rst::test_issue_310 FAILED [ 46%] rst2pdf/tests/input/test_issue_310_2.rst::test_issue_310_2 FAILED [ 46%] rst2pdf/tests/input/test_issue_311.rst::test_issue_311 FAILED [ 46%] rst2pdf/tests/input/test_issue_312.rst::test_issue_312 FAILED [ 47%] rst2pdf/tests/input/test_issue_312_2.rst::test_issue_312_2 SKIPPED (Image is too tall for page when width is 80%) [ 47%] rst2pdf/tests/input/test_issue_313.rst::test_issue_313 FAILED [ 47%] rst2pdf/tests/input/test_issue_315.rst::test_issue_315 FAILED [ 48%] rst2pdf/tests/input/test_issue_320.rst::test_issue_320 FAILED [ 48%] rst2pdf/tests/input/test_issue_321.rst::test_issue_321 FAILED [ 48%] rst2pdf/tests/input/test_issue_322.rst::test_issue_322 FAILED [ 49%] rst2pdf/tests/input/test_issue_328.rst::test_issue_328 FAILED [ 49%] rst2pdf/tests/input/test_issue_328_2.rst::test_issue_328_2 FAILED [ 50%] rst2pdf/tests/input/test_issue_330.rst::test_issue_330 FAILED [ 50%] rst2pdf/tests/input/test_issue_331.rst::test_issue_331 FAILED [ 50%] rst2pdf/tests/input/test_issue_335.rst::test_issue_335 FAILED [ 51%] rst2pdf/tests/input/test_issue_337.rst::test_issue_337 SKIPPED (`autoLeading: max` regression) [ 51%] rst2pdf/tests/input/test_issue_339.rst::test_issue_339 FAILED [ 51%] rst2pdf/tests/input/test_issue_340.rst::test_issue_340 FAILED [ 52%] rst2pdf/tests/input/test_issue_345.rst::test_issue_345 FAILED [ 52%] rst2pdf/tests/input/test_issue_349.rst::test_issue_349 FAILED [ 52%] rst2pdf/tests/input/test_issue_351.rst::test_issue_351 FAILED [ 53%] rst2pdf/tests/input/test_issue_356.rst::test_issue_356 FAILED [ 53%] rst2pdf/tests/input/test_issue_358.rst::test_issue_358 FAILED [ 53%] rst2pdf/tests/input/test_issue_361.rst::test_issue_361 FAILED [ 54%] rst2pdf/tests/input/test_issue_363.rst::test_issue_363 FAILED [ 54%] rst2pdf/tests/input/test_issue_366.rst::test_issue_366 FAILED [ 54%] rst2pdf/tests/input/test_issue_374.rst::test_issue_374 SKIPPED (Blank page before literal block as block overflows page) [ 55%] rst2pdf/tests/input/test_issue_378.rst::test_issue_378 SKIPPED (Fails to build PDF: AttributeError: ParaLines instance has no attribute 'lineBreak') [ 55%] rst2pdf/tests/input/test_issue_379.rst::test_issue_379 FAILED [ 55%] rst2pdf/tests/input/test_issue_383.rst::test_issue_383 FAILED [ 56%] rst2pdf/tests/input/test_issue_390.rst::test_issue_390 SKIPPED (--config switch doesn't work.) [ 56%] rst2pdf/tests/input/test_issue_391.rst::test_issue_391 FAILED [ 56%] rst2pdf/tests/input/test_issue_410.rst::test_issue_410 FAILED [ 57%] rst2pdf/tests/input/test_issue_419.rst::test_issue_419 SKIPPED (Admonitions have limited styling) [ 57%] rst2pdf/tests/input/test_issue_427.rst::test_issue_427 FAILED [ 57%] rst2pdf/tests/input/test_issue_452.rst::test_issue_452 FAILED [ 58%] rst2pdf/tests/input/test_issue_461.rst::test_issue_461 FAILED [ 58%] rst2pdf/tests/input/test_issue_464.rst::test_issue_464 FAILED [ 58%] rst2pdf/tests/input/test_issue_467.rst::test_issue_467 SKIPPED (Inline syntax highlighting is not applied) [ 59%] rst2pdf/tests/input/test_issue_46_malformed_xml_when_reportlab_processes_paragraph.rst::test_issue_46_malformed_xml_when_reportlab_processes_paragraph FAILED [ 59%] rst2pdf/tests/input/test_issue_470.rst::test_issue_470 FAILED [ 59%] rst2pdf/tests/input/test_issue_471.rst::test_issue_471 FAILED [ 60%] rst2pdf/tests/input/test_issue_473.rst::test_issue_473 FAILED [ 60%] rst2pdf/tests/input/test_issue_478.rst::test_issue_478 SKIPPED (Tables in blockquotes inside tables have the wrong width) [ 60%] rst2pdf/tests/input/test_issue_485.rst::test_issue_485 FAILED [ 61%] rst2pdf/tests/input/test_issue_485_2.rst::test_issue_485_2 FAILED [ 61%] rst2pdf/tests/input/test_issue_50_non_existent_image_should_not_crash.rst::test_issue_50_non_existent_image_should_not_crash FAILED [ 61%] rst2pdf/tests/input/test_issue_547.rst::test_issue_547 FAILED [ 62%] rst2pdf/tests/input/test_issue_549.rst::test_issue_549 FAILED [ 62%] rst2pdf/tests/input/test_issue_560.rst::test_issue_560 FAILED [ 62%] rst2pdf/tests/input/test_issue_569.rst::test_issue_569 FAILED [ 63%] rst2pdf/tests/input/test_issue_64_handle_author_and_email_addresses_in_metadata.rst::test_issue_64_handle_author_and_email_addresses_in_metadata FAILED [ 63%] rst2pdf/tests/input/test_issue_64_handle_multiple_authors_in_metadata.rst::test_issue_64_handle_multiple_authors_in_metadata FAILED [ 63%] rst2pdf/tests/input/test_issue_65_font_alias_to_embedded_font_should_not_include_helvetica.rst::test_issue_65_font_alias_to_embedded_font_should_not_include_helvetica FAILED [ 64%] rst2pdf/tests/input/test_issue_65_font_alias_to_embedded_font_should_not_include_times_new_roman_2.rst::test_issue_65_font_alias_to_embedded_font_should_not_include_times_new_roman_2 FAILED [ 64%] rst2pdf/tests/input/test_issue_67_indentation_for_lists_with_changing_bullet_width.rst::test_issue_67_indentation_for_lists_with_changing_bullet_width FAILED [ 64%] rst2pdf/tests/input/test_issue_68_explicit_leading_break_with_inferred_from_fontsize_1.rst::test_issue_68_explicit_leading_break_with_inferred_from_fontsize_1 FAILED [ 65%] rst2pdf/tests/input/test_issue_68_explicit_leading_break_with_inferred_from_fontsize_2.rst::test_issue_68_explicit_leading_break_with_inferred_from_fontsize_2 FAILED [ 65%] rst2pdf/tests/input/test_issue_69_empty_itemized_list_item_causes_backtrace.rst::test_issue_69_empty_itemized_list_item_causes_backtrace FAILED [ 65%] rst2pdf/tests/input/test_issue_70_table_errors_being_upgraded_to_warning.rst::test_issue_70_table_errors_being_upgraded_to_warning FAILED [ 66%] rst2pdf/tests/input/test_issue_70_table_errors_being_upgraded_to_warning_2.rst::test_issue_70_table_errors_being_upgraded_to_warning_2 FAILED [ 66%] rst2pdf/tests/input/test_issue_72_numbered_lists_start_with_expected_index.rst::test_issue_72_numbered_lists_start_with_expected_index FAILED [ 66%] rst2pdf/tests/input/test_issue_73_unicode_box_drawing_characters_renders_without_errors.rst::test_issue_73_unicode_box_drawing_characters_renders_without_errors FAILED [ 67%] rst2pdf/tests/input/test_issue_74_titled_paragraphs_title_leading_too_small.rst::test_issue_74_titled_paragraphs_title_leading_too_small FAILED [ 67%] rst2pdf/tests/input/test_issue_754.rst::test_issue_754 FAILED [ 67%] rst2pdf/tests/input/test_issue_785.rst::test_issue_785 FAILED [ 68%] rst2pdf/tests/input/test_issue_83_backColor_works_for_non_named_colors.rst::test_issue_83_backColor_works_for_non_named_colors FAILED [ 68%] rst2pdf/tests/input/test_issue_84_relative_include_paths_broken_when_start_file_not_in_working_directory.rst::test_issue_84_relative_include_paths_broken_when_start_file_not_in_working_directory FAILED [ 68%] rst2pdf/tests/input/test_issue_91_definition_list_indentation_broken.rst::test_issue_91_definition_list_indentation_broken FAILED [ 69%] rst2pdf/tests/input/test_issue_95_indented_table_should_not_produce_error.rst::test_issue_95_indented_table_should_not_produce_error FAILED [ 69%] rst2pdf/tests/input/test_issue_99_headers_and_footers_error_with_wordaxe_installed.rst::test_issue_99_headers_and_footers_error_with_wordaxe_installed FAILED [ 69%] rst2pdf/tests/input/test_jpg_scaling.rst::test_jpg_scaling FAILED [ 70%] rst2pdf/tests/input/test_landscape.rst::test_landscape FAILED [ 70%] rst2pdf/tests/input/test_lineno.rst::test_lineno FAILED [ 70%] rst2pdf/tests/input/test_list_table.rst::test_list_table FAILED [ 71%] rst2pdf/tests/input/test_lists.rst::test_lists SKIPPED (Padding issue with 5th level lists) [ 71%] rst2pdf/tests/input/test_malformed_rst.rst::test_malformed_rst PASSED [ 71%] rst2pdf/tests/input/test_math.rst::test_math FAILED [ 72%] rst2pdf/tests/input/test_math2.rst::test_math2 SKIPPED (Multitple issues with formulae) [ 72%] rst2pdf/tests/input/test_math_default_role.rst::test_math_default_role FAILED [ 72%] rst2pdf/tests/input/test_math_role.rst::test_math_role FAILED [ 73%] rst2pdf/tests/input/test_multiline_header.rst::test_multiline_header FAILED [ 73%] rst2pdf/tests/input/test_multiple_styles.rst::test_multiple_styles FAILED [ 73%] rst2pdf/tests/input/test_multiple_stylesheet_files.rst::test_multiple_stylesheet_files FAILED [ 74%] rst2pdf/tests/input/test_nested_lists_page_layout.rst::test_nested_lists_page_layout FAILED [ 74%] rst2pdf/tests/input/test_no_language_set_on_code_block.rst::test_no_language_set_on_code_block FAILED [ 75%] rst2pdf/tests/input/test_no_raw_html.rst::test_no_raw_html FAILED [ 75%] rst2pdf/tests/input/test_oddeven.rst::test_oddeven FAILED [ 75%] rst2pdf/tests/input/test_option_list.rst::test_option_list FAILED [ 76%] rst2pdf/tests/input/test_page_counter.rst::test_page_counter FAILED [ 76%] rst2pdf/tests/input/test_page_labels.rst::test_page_labels FAILED [ 76%] rst2pdf/tests/input/test_png_dpi.rst::test_png_dpi FAILED [ 77%] rst2pdf/tests/input/test_ps_font.rst::test_ps_font FAILED [ 77%] rst2pdf/tests/input/test_raw.rst::test_raw FAILED [ 77%] rst2pdf/tests/input/test_reference-font-with-dir-fails.rst::test_reference-font-with-dir-fails PASSED [ 78%] rst2pdf/tests/input/test_repeat-table-rows.rst::test_repeat-table-rows FAILED [ 78%] rst2pdf/tests/input/test_replacement_text.rst::test_replacement_text FAILED [ 78%] rst2pdf/tests/input/test_reportlab_issue_81.rst::test_reportlab_issue_81 FAILED [ 79%] rst2pdf/tests/input/test_scale_width.rst::test_scale_width FAILED [ 79%] rst2pdf/tests/input/test_sidebar_literal.rst::test_sidebar_literal FAILED [ 79%] rst2pdf/tests/input/test_sidebar_literal2.rst::test_sidebar_literal2 FAILED [ 80%] rst2pdf/tests/input/test_slides.rst::test_slides FAILED [ 80%] rst2pdf/tests/input/test_smarty.rst::test_smarty FAILED [ 80%] rst2pdf/tests/input/test_span_cells.rst::test_span_cells FAILED [ 81%] rst2pdf/tests/input/test_split_notes.rst::test_split_notes FAILED [ 81%] rst2pdf/tests/input/test_strip_elements.rst::test_strip_elements FAILED [ 81%] rst2pdf/tests/input/test_style_width.rst::test_style_width SKIPPED (Table width is incorrect) [ 82%] rst2pdf/tests/input/test_substituted-font-alias-generates-a-warning.rst::test_substituted-font-alias-generates-a-warning PASSED [ 82%] rst2pdf/tests/input/test_svg.rst::test_svg FAILED [ 82%] rst2pdf/tests/input/test_svg_alignment.rst::test_svg_alignment FAILED [ 83%] rst2pdf/tests/input/test_table_1.rst::test_table_1 FAILED [ 83%] rst2pdf/tests/input/test_table_classes.rst::test_table_classes FAILED [ 83%] rst2pdf/tests/input/test_table_space.rst::test_table_space FAILED [ 84%] rst2pdf/tests/input/test_tableofcontents.rst::test_tableofcontents FAILED [ 84%] rst2pdf/tests/input/test_tabwidth.rst::test_tabwidth FAILED [ 84%] rst2pdf/tests/input/test_title_ref.rst::test_title_ref FAILED [ 85%] rst2pdf/tests/input/test_transitions.rst::test_transitions FAILED [ 85%] rst2pdf/tests/input/test_unicode_headings.rst::test_unicode_headings FAILED [ 85%] rst2pdf/tests/input/test_write_to_stdout.rst::test_write_to_stdout PASSED [ 86%] rst2pdf/tests/input/textannotation.rst::textannotation FAILED [ 86%] rst2pdf/tests/input/too-tall-image-in-figure.rst::too-tall-image-in-figure FAILED [ 86%] rst2pdf/tests/input/too-tall-image-in-table.rst::too-tall-image-in-table FAILED [ 87%] rst2pdf/tests/input/sphinx-break-level-0/conf.py::sphinx-break-level-0 FAILED [ 87%] rst2pdf/tests/input/sphinx-break-level-1/conf.py::sphinx-break-level-1 FAILED [ 87%] rst2pdf/tests/input/sphinx-break-level-2/conf.py::sphinx-break-level-2 FAILED [ 88%] rst2pdf/tests/input/sphinx-brokenlinks/conf.py::sphinx-brokenlinks SKIPPED (sphinx-brokenlinks/doc1.pdf is empty) [ 88%] rst2pdf/tests/input/sphinx-issue158/conf.py::sphinx-issue158 FAILED [ 88%] rst2pdf/tests/input/sphinx-issue162/conf.py::sphinx-issue162 FAILED [ 89%] rst2pdf/tests/input/sphinx-issue166/conf.py::sphinx-issue166 FAILED [ 89%] rst2pdf/tests/input/sphinx-issue168/conf.py::sphinx-issue168 FAILED [ 89%] rst2pdf/tests/input/sphinx-issue169/conf.py::sphinx-issue169 FAILED [ 90%] rst2pdf/tests/input/sphinx-issue170/conf.py::sphinx-issue170 FAILED [ 90%] rst2pdf/tests/input/sphinx-issue172/conf.py::sphinx-issue172 FAILED [ 90%] rst2pdf/tests/input/sphinx-issue183/conf.py::sphinx-issue183 FAILED [ 91%] rst2pdf/tests/input/sphinx-issue187/conf.py::sphinx-issue187 FAILED [ 91%] rst2pdf/tests/input/sphinx-issue196/conf.py::sphinx-issue196 FAILED [ 91%] rst2pdf/tests/input/sphinx-issue229/conf.py::sphinx-issue229 FAILED [ 92%] rst2pdf/tests/input/sphinx-issue251/conf.py::sphinx-issue251 SKIPPED (A different MD5 checksum is created each time) [ 92%] rst2pdf/tests/input/sphinx-issue252/conf.py::sphinx-issue252 FAILED [ 92%] rst2pdf/tests/input/sphinx-issue254/conf.py::sphinx-issue254 FAILED [ 93%] rst2pdf/tests/input/sphinx-issue257/conf.py::sphinx-issue257 FAILED [ 93%] rst2pdf/tests/input/sphinx-issue280/conf.py::sphinx-issue280 FAILED [ 93%] rst2pdf/tests/input/sphinx-issue284/conf.py::sphinx-issue284 FAILED [ 94%] rst2pdf/tests/input/sphinx-issue285/conf.py::sphinx-issue285 FAILED [ 94%] rst2pdf/tests/input/sphinx-issue318/conf.py::sphinx-issue318 FAILED [ 94%] rst2pdf/tests/input/sphinx-issue319/conf.py::sphinx-issue319 FAILED [ 95%] rst2pdf/tests/input/sphinx-issue320/conf.py::sphinx-issue320 FAILED [ 95%] rst2pdf/tests/input/sphinx-issue360/conf.py::sphinx-issue360 FAILED [ 95%] rst2pdf/tests/input/sphinx-issue364/conf.py::sphinx-issue364 FAILED [ 96%] rst2pdf/tests/input/sphinx-issue367/conf.py::sphinx-issue367 FAILED [ 96%] rst2pdf/tests/input/sphinx-issue388/conf.py::sphinx-issue388 FAILED [ 96%] rst2pdf/tests/input/sphinx-issue513/conf.py::sphinx-issue513 FAILED [ 97%] rst2pdf/tests/input/sphinx-issue529/conf.py::sphinx-issue529 FAILED [ 97%] rst2pdf/tests/input/sphinx-issue601/conf.py::sphinx-issue601 FAILED [ 97%] rst2pdf/tests/input/sphinx-markup/conf.py::sphinx-markup SKIPPED (`cfunc` role is not handled correctly) [ 98%] rst2pdf/tests/input/sphinx-multidoc/conf.py::sphinx-multidoc FAILED [ 98%] rst2pdf/tests/input/sphinx-repeat-table-rows/conf.py::sphinx-repeat-table-rows FAILED [ 98%] rst2pdf/tests/input/sphinx-smartquotes/conf.py::sphinx-smartquotes FAILED [ 99%] rst2pdf/tests/input/sphinx-toc-depth/conf.py::sphinx-toc-depth FAILED [ 99%] rst2pdf/tests/input/sphinx-versionmodified/conf.py::sphinx-versionmodified FAILED [100%] =================================== FAILURES =================================== ________________________________ numbered_links ________________________________ cls = func = . at 0x4006f8fac0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/numbered_links.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/numbered_links.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ numbered_links_2 _______________________________ cls = func = . at 0x40031b3010> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/numbered_links_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/numbered_links_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________________ source ____________________________________ cls = func = . at 0x4006f8f880> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/source.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/source.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ styled_literal ________________________________ cls = func = . at 0x40031b31c0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/styled_literal.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/styled_literal.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________ test-referencing-an-aliased-font _______________________ cls = func = . at 0x4006faf910> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test-referencing-an-aliased-font.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test-referencing-an-aliased-font.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ___________________________________ test_753 ___________________________________ cls = func = . at 0x4006fafd90> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_753.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_753.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_aafigure _________________________________ cls = func = . at 0x4006faf520> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_aafigure.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_aafigure.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ test_aafigure_extra ______________________________ cls = func = . at 0x4006fafe20> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_aafigure_extra.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_aafigure_extra.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________ test_alignment_of_figures_and_images _____________________ cls = func = . at 0x4006faf130> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_alignment_of_figures_and_images.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_alignment_of_figures_and_images.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ___________________________ test_autoembedding_type1 ___________________________ cls = func = . at 0x4006fafb50> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_autoembedding_type1.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_autoembedding_type1.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_autoleading _______________________________ cls = func = . at 0x4006faef80> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_autoleading.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_autoleading.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_background ________________________________ cls = func = . at 0x40031b31c0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_background.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_background.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________ test_background_image _____________________________ cls = func = . at 0x40071d25f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_background_image.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_background_image.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ test_background_svg ______________________________ cls = func = . at 0x40071d13f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_background_svg.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_background_svg.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_base_url _________________________________ cls = func = . at 0x40071d3520> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_base_url.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_base_url.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError __________________________ test_blockquotes_in_table ___________________________ cls = func = . at 0x4006faf880> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_blockquotes_in_table.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_blockquotes_in_table.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_bullet_chars _______________________________ cls = func = . at 0x4006faf130> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_bullet_chars.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_bullet_chars.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_bullet_widths ______________________________ cls = func = . at 0x4006fafb50> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_bullet_widths.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_bullet_widths.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ test_codeblock_tabs ______________________________ cls = func = . at 0x40071d25f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_codeblock_tabs.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_codeblock_tabs.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError __________________________________ test_cover __________________________________ cls = func = . at 0x40071d1360> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_cover.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_cover.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _________________________________ test_cover_2 _________________________________ cls = func = . at 0x40071d2a70> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_cover_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_cover_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _________________________________ test_cover_3 _________________________________ cls = func = . at 0x40071d1c60> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_cover_3.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_cover_3.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_csv_table ________________________________ cls = func = . at 0x40071d2320> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_csv_table.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_csv_table.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_custom_cover _______________________________ cls = func = . at 0x40071d3c70> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_custom_cover.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_custom_cover.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________ test_definition_lists _____________________________ cls = func = . at 0x40071d3760> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_definition_lists.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_definition_lists.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_dict_styles _______________________________ cls = func = . at 0x40071d1900> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_dict_styles.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_dict_styles.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_docutils_math ______________________________ cls = func = . at 0x40071d36d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_docutils_math.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_docutils_math.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ___________________________ test_embedded_reference ____________________________ cls = func = . at 0x40073be710> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_embedded_reference.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_embedded_reference.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_extensions ________________________________ cls = func = . at 0x40073bf0a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_extensions.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_extensions.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_field_widths _______________________________ cls = func = . at 0x40071d3ac0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_field_widths.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_field_widths.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________ test_figure_alignment _____________________________ cls = func = . at 0x40071d3f40> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_figure_alignment.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_figure_alignment.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_fontsizeunits ______________________________ cls = func = . at 0x40071d2320> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_fontsizeunits.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_fontsizeunits.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_footnotes ________________________________ cls = func = . at 0x40073bdc60> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_footnotes.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_footnotes.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_foreground ________________________________ cls = func = . at 0x40073bc0d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_foreground.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_foreground.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_framebreak ________________________________ cls = func = . at 0x40073be9e0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_framebreak.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_framebreak.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError __________________________________ test_greek __________________________________ cls = func = . at 0x40073bf130> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_greek.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_greek.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_header_footer ______________________________ cls = func = . at 0x40073bdc60> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_header_footer.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_header_footer.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________ test_header_separator _____________________________ cls = func = . at 0x40073bf880> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_header_separator.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_header_separator.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_hl_lines _________________________________ cls = func = . at 0x40073beb00> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_hl_lines.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_hl_lines.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ test_image_alignment _____________________________ cls = func = . at 0x40073bd6c0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_image_alignment.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_image_alignment.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ test_image_directive _____________________________ cls = func = . at 0x40074620e0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_image_directive.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_image_directive.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_image_units _______________________________ cls = func = . at 0x4007460940> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_image_units.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_image_units.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_img_header ________________________________ cls = func = . at 0x40074630a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_img_header.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_img_header.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_inline_colors ______________________________ cls = func = . at 0x40073bfac0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_inline_colors.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_inline_colors.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_inline_image _______________________________ cls = func = . at 0x40073bf130> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_inline_image.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_inline_image.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_internal_link ______________________________ cls = func = . at 0x40074639a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_internal_link.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_internal_link.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_103 ________________________________ cls = func = . at 0x40074627a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_103.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_103.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_104 ________________________________ cls = func = . at 0x4007461120> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_104.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_104.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_107 ________________________________ cls = func = . at 0x40074601f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_107.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_107.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_109 ________________________________ cls = func = . at 0x4007462a70> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_109.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_109.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_112 ________________________________ cls = func = . at 0x40074600d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_112.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_112.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_113 ________________________________ cls = func = . at 0x40074636d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_113.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_113.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_114 ________________________________ cls = func = . at 0x4007462b00> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_114.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_114.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_116 ________________________________ cls = func = . at 0x40074627a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_116.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_116.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_117 ________________________________ cls = func = . at 0x4007462dd0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_117.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_117.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_118 ________________________________ cls = func = . at 0x4007485b40> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_118.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_118.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_issue_118_2 _______________________________ cls = func = . at 0x40074860e0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_118_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_118_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_issue_118_3 _______________________________ cls = func = . at 0x4007463b50> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_118_3.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_118_3.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_119 ________________________________ cls = func = . at 0x4007463640> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_119.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_119.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_128 ________________________________ cls = func = . at 0x40074600d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_128.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_128.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_132 ________________________________ cls = func = . at 0x4007485360> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_132.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_132.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_134 ________________________________ cls = func = . at 0x4007487130> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_134.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_134.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_137 ________________________________ cls = func = . at 0x40074876d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_137.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_137.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_138 ________________________________ cls = func = . at 0x4007487d00> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_138.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_138.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_140 ________________________________ cls = func = . at 0x4007487400> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_140.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_140.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_143 ________________________________ cls = func = . at 0x4007486950> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_143.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_143.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_144 ________________________________ cls = func = . at 0x4007484f70> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_144.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_144.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_146 ________________________________ cls = func = . at 0x4007486320> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_146.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_146.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_147 ________________________________ cls = func = . at 0x4007486b90> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_147.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_147.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_151 ________________________________ cls = func = . at 0x400764d2d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_151.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_151.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_152 ________________________________ cls = func = . at 0x400764d870> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_152.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_152.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_154 ________________________________ cls = func = . at 0x4007487400> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_154.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_154.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_155 ________________________________ cls = func = . at 0x4007487e20> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_155.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_155.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_156 ________________________________ cls = func = . at 0x4007487d00> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_156.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_156.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_159 ________________________________ cls = func = . at 0x4007486dd0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_159.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_159.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_165 ________________________________ cls = func = . at 0x400764e8c0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_165.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_165.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_173 ________________________________ cls = func = . at 0x400764ee60> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_173.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_173.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_174 ________________________________ cls = func = . at 0x400764f400> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_174.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_174.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_175 ________________________________ cls = func = . at 0x400764f490> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_175.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_175.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_176 ________________________________ cls = func = . at 0x400764fd00> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_176.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_176.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_issue_180_1 _______________________________ cls = func = . at 0x400764c3a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_180_1.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_180_1.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_issue_180_2 _______________________________ cls = func = . at 0x400764f910> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_180_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_180_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_181 ________________________________ cls = func = . at 0x400764fe20> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_181.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_181.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_186 ________________________________ cls = func = . at 0x400764d480> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_186.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_186.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_issue_186_2 _______________________________ cls = func = . at 0x400764d2d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_186_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_186_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_issue_186_3 _______________________________ cls = func = . at 0x400764e440> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_186_3.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_186_3.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_196 ________________________________ cls = func = . at 0x400764f130> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_196.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_196.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_197 ________________________________ cls = func = . at 0x400764ff40> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_197.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_197.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_199 ________________________________ cls = func = . at 0x400764f9a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_199.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_199.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_200 ________________________________ cls = func = . at 0x4007726050> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_200.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_200.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_201 ________________________________ cls = func = . at 0x40077265f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_201.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_201.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_202 ________________________________ cls = func = . at 0x4007726b90> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_202.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_202.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_203 ________________________________ cls = func = . at 0x400764d2d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_203.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_203.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_217 ________________________________ cls = func = . at 0x4007727490> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_217.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_217.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_223 ________________________________ cls = func = . at 0x40077271c0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_223.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_223.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_224 ________________________________ cls = func = . at 0x4007725750> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_224.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_224.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_225 ________________________________ cls = func = . at 0x4007727c70> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_225.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_225.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_226 ________________________________ cls = func = . at 0x4007727d90> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_226.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_226.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_227 ________________________________ cls = func = . at 0x40077255a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_227.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_227.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_230 ________________________________ cls = func = . at 0x4007725750> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_230.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_230.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_231 ________________________________ cls = func = . at 0x4007727490> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_231.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_231.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_232 ________________________________ cls = func = . at 0x40077267a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_232.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_232.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_234 ________________________________ cls = func = . at 0x4007725cf0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_234.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_234.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_238 ________________________________ cls = func = . at 0x400769d7e0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_238.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_238.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_241 ________________________________ cls = func = . at 0x400769d480> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_241.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_241.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_243 ________________________________ cls = func = . at 0x400769dd80> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_243.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_243.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_244 ________________________________ cls = func = . at 0x4007727520> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_244.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_244.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_248 ________________________________ cls = func = . at 0x40077255a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_248.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_248.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_249 ________________________________ cls = func = . at 0x400769ee60> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_249.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_249.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_264 ________________________________ cls = func = . at 0x400769ea70> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_264.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_264.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_274 ________________________________ cls = func = . at 0x400769c3a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_274.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_274.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_277 ________________________________ cls = func = . at 0x400769f9a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_277.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_277.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_issue_277_2 _______________________________ cls = func = . at 0x400769d000> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_277_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_277_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_290 ________________________________ cls = func = . at 0x400769f640> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_290.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_290.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_291 ________________________________ cls = func = . at 0x400769c9d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_291.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_291.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_292 ________________________________ cls = func = . at 0x400769f1c0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_292.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_292.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_293 ________________________________ cls = func = . at 0x400769f130> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_293.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_293.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_297 ________________________________ cls = func = . at 0x400769e8c0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_297.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_297.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_298 ________________________________ cls = func = . at 0x400778d5a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_298.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_298.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_299 ________________________________ cls = func = . at 0x400778db40> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_299.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_299.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_301 ________________________________ cls = func = . at 0x400769ee60> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_301.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_301.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_302 ________________________________ cls = func = . at 0x400769f5b0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_302.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_302.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_304 ________________________________ cls = func = . at 0x400769d000> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_304.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_304.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_305 ________________________________ cls = func = . at 0x400778d5a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_305.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_305.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_307 ________________________________ cls = func = . at 0x400778eb00> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_307.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_307.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_309 ________________________________ cls = func = . at 0x400778f130> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_309.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_309.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_310 ________________________________ cls = func = . at 0x400778f6d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_310.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_310.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_issue_310_2 _______________________________ cls = func = . at 0x400778fac0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_310_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_310_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_311 ________________________________ cls = func = . at 0x400778f130> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_311.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_311.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_312 ________________________________ cls = func = . at 0x400778e0e0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_312.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_312.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_313 ________________________________ cls = func = . at 0x400778db40> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_313.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_313.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_315 ________________________________ cls = func = . at 0x400778e4d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_315.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_315.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_320 ________________________________ cls = func = . at 0x400778d000> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_320.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_320.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_321 ________________________________ cls = func = . at 0x40079012d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_321.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_321.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_322 ________________________________ cls = func = . at 0x400778fd00> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_322.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_322.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_328 ________________________________ cls = func = . at 0x400778f400> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_328.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_328.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_issue_328_2 _______________________________ cls = func = . at 0x400778fa30> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_328_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_328_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_330 ________________________________ cls = func = . at 0x400778fac0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_330.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_330.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_331 ________________________________ cls = func = . at 0x4007902320> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_331.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_331.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_335 ________________________________ cls = func = . at 0x40079028c0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_335.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_335.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_339 ________________________________ cls = func = . at 0x40079024d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_339.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_339.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_340 ________________________________ cls = func = . at 0x400778fc70> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_340.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_340.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_345 ________________________________ cls = func = . at 0x4007903400> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_345.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_345.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_349 ________________________________ cls = func = . at 0x40079039a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_349.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_349.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_351 ________________________________ cls = func = . at 0x4007901c60> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_351.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_351.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_356 ________________________________ cls = func = . at 0x4007903c70> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_356.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_356.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_358 ________________________________ cls = func = . at 0x4007903eb0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_358.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_358.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_361 ________________________________ cls = func = . at 0x4007902e60> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_361.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_361.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_363 ________________________________ cls = func = . at 0x40079035b0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_363.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_363.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_366 ________________________________ cls = func = . at 0x40079025f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_366.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_366.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_379 ________________________________ cls = func = . at 0x40079e4f70> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_379.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_379.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_383 ________________________________ cls = func = . at 0x40079036d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_383.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_383.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_391 ________________________________ cls = func = . at 0x40079e5d80> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_391.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_391.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_410 ________________________________ cls = func = . at 0x40079e5a20> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_410.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_410.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_427 ________________________________ cls = func = . at 0x40079e5c60> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_427.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_427.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_452 ________________________________ cls = func = . at 0x4007902e60> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_452.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_452.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_461 ________________________________ cls = func = . at 0x40079e6d40> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_461.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_461.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_464 ________________________________ cls = func = . at 0x40079e72e0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_464.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_464.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________ test_issue_46_malformed_xml_when_reportlab_processes_paragraph ________ cls = func = . at 0x40079e4ee0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_46_malformed_xml_when_reportlab_processes_paragraph.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_46_malformed_xml_when_reportlab_processes_paragraph.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_470 ________________________________ cls = func = . at 0x40079e5750> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_470.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_470.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_471 ________________________________ cls = func = . at 0x40079e7d00> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_471.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_471.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_473 ________________________________ cls = func = . at 0x40079e7e20> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_473.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_473.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_485 ________________________________ cls = func = . at 0x40079e6ef0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_485.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_485.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_issue_485_2 _______________________________ cls = func = . at 0x40079e6320> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_485_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_485_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________ test_issue_50_non_existent_image_should_not_crash _______________ cls = func = . at 0x40079e4ee0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_50_non_existent_image_should_not_crash.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_50_non_existent_image_should_not_crash.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_547 ________________________________ cls = func = . at 0x40079e7880> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_547.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_547.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_549 ________________________________ cls = func = . at 0x40079e4550> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_549.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_549.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_560 ________________________________ cls = func = . at 0x4007a25870> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_560.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_560.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_569 ________________________________ cls = func = . at 0x4007a25e10> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_569.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_569.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _________ test_issue_64_handle_author_and_email_addresses_in_metadata __________ cls = func = . at 0x40079e7eb0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_64_handle_author_and_email_addresses_in_metadata.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_64_handle_author_and_email_addresses_in_metadata.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________ test_issue_64_handle_multiple_authors_in_metadata _______________ cls = func = . at 0x40079e5e10> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_64_handle_multiple_authors_in_metadata.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_64_handle_multiple_authors_in_metadata.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____ test_issue_65_font_alias_to_embedded_font_should_not_include_helvetica ____ cls = func = . at 0x40079e7e20> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_65_font_alias_to_embedded_font_should_not_include_helvetica.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_65_font_alias_to_embedded_font_should_not_include_helvetica.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _ test_issue_65_font_alias_to_embedded_font_should_not_include_times_new_roman_2 _ cls = func = . at 0x4007a26560> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_65_font_alias_to_embedded_font_should_not_include_times_new_roman_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_65_font_alias_to_embedded_font_should_not_include_times_new_roman_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________ test_issue_67_indentation_for_lists_with_changing_bullet_width ________ cls = func = . at 0x4007a241f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_67_indentation_for_lists_with_changing_bullet_width.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_67_indentation_for_lists_with_changing_bullet_width.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______ test_issue_68_explicit_leading_break_with_inferred_from_fontsize_1 ______ cls = func = . at 0x4007a26440> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_68_explicit_leading_break_with_inferred_from_fontsize_1.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_68_explicit_leading_break_with_inferred_from_fontsize_1.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______ test_issue_68_explicit_leading_break_with_inferred_from_fontsize_2 ______ cls = func = . at 0x4007a272e0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_68_explicit_leading_break_with_inferred_from_fontsize_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_68_explicit_leading_break_with_inferred_from_fontsize_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ___________ test_issue_69_empty_itemized_list_item_causes_backtrace ____________ cls = func = . at 0x4007a27d90> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_69_empty_itemized_list_item_causes_backtrace.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_69_empty_itemized_list_item_causes_backtrace.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________ test_issue_70_table_errors_being_upgraded_to_warning _____________ cls = func = . at 0x4007a26680> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_70_table_errors_being_upgraded_to_warning.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_70_table_errors_being_upgraded_to_warning.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________ test_issue_70_table_errors_being_upgraded_to_warning_2 ____________ cls = func = . at 0x4007a24c10> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_70_table_errors_being_upgraded_to_warning_2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_70_table_errors_being_upgraded_to_warning_2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________ test_issue_72_numbered_lists_start_with_expected_index ____________ cls = func = . at 0x4007a276d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_72_numbered_lists_start_with_expected_index.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_72_numbered_lists_start_with_expected_index.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____ test_issue_73_unicode_box_drawing_characters_renders_without_errors ______ cls = func = . at 0x4007a26050> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_73_unicode_box_drawing_characters_renders_without_errors.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_73_unicode_box_drawing_characters_renders_without_errors.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ___________ test_issue_74_titled_paragraphs_title_leading_too_small ____________ cls = func = . at 0x4007ae5360> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_74_titled_paragraphs_title_leading_too_small.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_74_titled_paragraphs_title_leading_too_small.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_754 ________________________________ cls = func = . at 0x4007ae5900> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_754.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_754.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_issue_785 ________________________________ cls = func = . at 0x4007a27d90> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_785.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_785.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________ test_issue_83_backColor_works_for_non_named_colors ______________ cls = func = . at 0x4007a27be0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_83_backColor_works_for_non_named_colors.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_83_backColor_works_for_non_named_colors.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _ test_issue_84_relative_include_paths_broken_when_start_file_not_in_working_directory _ cls = func = . at 0x4007a272e0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_84_relative_include_paths_broken_when_start_file_not_in_working_directory.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_84_relative_include_paths_broken_when_start_file_not_in_working_directory.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________ test_issue_91_definition_list_indentation_broken _______________ cls = func = . at 0x4007a25fc0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_91_definition_list_indentation_broken.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_91_definition_list_indentation_broken.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________ test_issue_95_indented_table_should_not_produce_error _____________ cls = func = . at 0x4007ae6950> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_95_indented_table_should_not_produce_error.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_95_indented_table_should_not_produce_error.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________ test_issue_99_headers_and_footers_error_with_wordaxe_installed ________ cls = func = . at 0x4007ae55a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_issue_99_headers_and_footers_error_with_wordaxe_installed.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_issue_99_headers_and_footers_error_with_wordaxe_installed.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_jpg_scaling _______________________________ cls = func = . at 0x4007ae7520> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_jpg_scaling.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_jpg_scaling.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_landscape ________________________________ cls = func = . at 0x4007ae7640> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_landscape.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_landscape.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _________________________________ test_lineno __________________________________ cls = func = . at 0x4007ae7e20> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_lineno.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_lineno.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_list_table ________________________________ cls = func = . at 0x4007ae63b0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_list_table.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_list_table.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError __________________________________ test_math ___________________________________ cls = func = . at 0x4007ae64d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_math.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_math.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________ test_math_default_role ____________________________ cls = func = . at 0x4007ae5360> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_math_default_role.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_math_default_role.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_math_role ________________________________ cls = func = . at 0x4007becd30> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_math_role.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_math_role.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________ test_multiline_header _____________________________ cls = func = . at 0x4007bed3f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_multiline_header.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_multiline_header.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ test_multiple_styles _____________________________ cls = func = . at 0x4007ae55a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_multiple_styles.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_multiple_styles.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________ test_multiple_stylesheet_files ________________________ cls = func = . at 0x4007ae7520> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_multiple_stylesheet_files.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_multiple_stylesheet_files.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________ test_nested_lists_page_layout _________________________ cls = func = . at 0x4007ae7640> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_nested_lists_page_layout.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_nested_lists_page_layout.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________ test_no_language_set_on_code_block ______________________ cls = func = . at 0x4007bec8b0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': } argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': } firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_no_language_set_on_code_block.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_no_language_set_on_code_block.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_no_raw_html _______________________________ cls = func = . at 0x4007bef250> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_no_raw_html.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_no_raw_html.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _________________________________ test_oddeven _________________________________ cls = func = . at 0x4007befb50> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_oddeven.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_oddeven.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_option_list _______________________________ cls = func = . at 0x4007befbe0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_option_list.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_option_list.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_page_counter _______________________________ cls = func = . at 0x4007bef7f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_page_counter.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_page_counter.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_page_labels _______________________________ cls = func = . at 0x4007bed900> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_page_labels.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_page_labels.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _________________________________ test_png_dpi _________________________________ cls = func = . at 0x4007bedd80> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_png_dpi.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_png_dpi.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _________________________________ test_ps_font _________________________________ cls = func = . at 0x4007bed630> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_ps_font.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_ps_font.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ___________________________________ test_raw ___________________________________ cls = func = . at 0x4007bec700> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_raw.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_raw.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________ test_repeat-table-rows ____________________________ cls = func = . at 0x4006fad630> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_repeat-table-rows.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_repeat-table-rows.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________ test_replacement_text _____________________________ cls = func = . at 0x4006fad480> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_replacement_text.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_replacement_text.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ___________________________ test_reportlab_issue_81 ____________________________ cls = func = . at 0x4007bedd80> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_reportlab_issue_81.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_reportlab_issue_81.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_scale_width _______________________________ cls = func = . at 0x4007bef880> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_scale_width.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_scale_width.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ test_sidebar_literal _____________________________ cls = func = . at 0x4006fac700> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_sidebar_literal.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_sidebar_literal.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________ test_sidebar_literal2 _____________________________ cls = func = . at 0x4007beef80> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_sidebar_literal2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_sidebar_literal2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _________________________________ test_slides __________________________________ cls = func = . at 0x4007bec0d0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_slides.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_slides.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _________________________________ test_smarty __________________________________ cls = func = . at 0x4007c0f370> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_smarty.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_smarty.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_span_cells ________________________________ cls = func = . at 0x4007c0f880> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_span_cells.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_span_cells.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_split_notes _______________________________ cls = func = . at 0x4006fac700> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_split_notes.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_split_notes.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ test_strip_elements ______________________________ cls = func = . at 0x4007becdc0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_strip_elements.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_strip_elements.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ___________________________________ test_svg ___________________________________ cls = func = . at 0x4007bef250> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_svg.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_svg.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_svg_alignment ______________________________ cls = func = . at 0x4007bef2e0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_svg_alignment.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_svg_alignment.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _________________________________ test_table_1 _________________________________ cls = func = . at 0x4007c0dc60> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_table_1.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_table_1.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ test_table_classes ______________________________ cls = func = . at 0x4007c0e5f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_table_classes.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_table_classes.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_table_space _______________________________ cls = func = . at 0x4007c0e680> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_table_space.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_table_space.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ test_tableofcontents _____________________________ cls = func = . at 0x4007c0e3b0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_tableofcontents.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_tableofcontents.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_tabwidth _________________________________ cls = func = . at 0x4007c0ef80> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_tabwidth.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_tabwidth.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ test_title_ref ________________________________ cls = func = . at 0x4007c0f400> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_title_ref.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_title_ref.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ test_transitions _______________________________ cls = func = . at 0x4007c0d5a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_transitions.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_transitions.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________ test_unicode_headings _____________________________ cls = func = . at 0x4007cd5ea0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/test_unicode_headings.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/test_unicode_headings.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ________________________________ textannotation ________________________________ cls = func = . at 0x4006fad510> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/textannotation.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/textannotation.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ___________________________ too-tall-image-in-figure ___________________________ cls = func = . at 0x4007cd6dd0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/too-tall-image-in-figure.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/too-tall-image-in-figure.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ___________________________ too-tall-image-in-table ____________________________ cls = func = . at 0x4007c0e680> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/too-tall-image-in-table.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/too-tall-image-in-table.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ sphinx-break-level-0 _____________________________ cls = func = . at 0x4007c0e440> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-break-level-0.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-break-level-0.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ sphinx-break-level-1 _____________________________ cls = func = . at 0x4007c0da20> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-break-level-1.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-break-level-1.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _____________________________ sphinx-break-level-2 _____________________________ cls = func = . at 0x4007cd41f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-break-level-2.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-break-level-2.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue158 ________________________________ cls = func = . at 0x4007cd6680> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue158.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue158.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue162 ________________________________ cls = func = . at 0x4007c6d000> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue162.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue162.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue166 ________________________________ cls = func = . at 0x4007c6d5a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue166.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue166.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue168 ________________________________ cls = func = . at 0x4007cd56c0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue168.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue168.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue169 ________________________________ cls = func = . at 0x4007cd6dd0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue169.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue169.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue170 ________________________________ cls = func = . at 0x4007cd6ef0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue170.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue170.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue172 ________________________________ cls = func = . at 0x4007cd6200> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue172.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue172.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue183 ________________________________ cls = func = . at 0x4007cd7c70> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue183.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue183.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue187 ________________________________ cls = func = . at 0x4007c6d240> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue187.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue187.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue196 ________________________________ cls = func = . at 0x4007c6e710> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue196.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue196.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue229 ________________________________ cls = func = . at 0x4007cd56c0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue229.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue229.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue252 ________________________________ cls = func = . at 0x4007cd6290> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue252.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue252.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue254 ________________________________ cls = func = . at 0x4007c6f130> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue254.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue254.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue257 ________________________________ cls = func = . at 0x4007c6d870> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue257.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue257.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue280 ________________________________ cls = func = . at 0x4007c6f760> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue280.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue280.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue284 ________________________________ cls = func = . at 0x4007c6fd90> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue284.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue284.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue285 ________________________________ cls = func = . at 0x4007c6caf0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue285.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue285.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue318 ________________________________ cls = func = . at 0x4007c6dea0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue318.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue318.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue319 ________________________________ cls = func = . at 0x4007c6e320> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue319.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue319.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue320 ________________________________ cls = func = . at 0x4007c6c430> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue320.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue320.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue360 ________________________________ cls = func = . at 0x4007c6e950> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue360.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue360.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue364 ________________________________ cls = func = . at 0x4007c6ef80> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue364.pdf/index.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue364.pdf/index.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue367 ________________________________ cls = func = . at 0x4007d68dc0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue367.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue367.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue388 ________________________________ cls = func = . at 0x4007d6a290> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue388.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue388.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue513 ________________________________ cls = func = . at 0x4007c6d870> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue513.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue513.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue529 ________________________________ cls = func = . at 0x4007c6ff40> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue529.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue529.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-issue601 ________________________________ cls = func = . at 0x4007c6caf0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-issue601.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-issue601.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-multidoc ________________________________ cls = func = . at 0x4007d6a7a0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-multidoc.pdf/MyProject1.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-multidoc.pdf/MyProject1.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ___________________________ sphinx-repeat-table-rows ___________________________ cls = func = . at 0x4007d6a710> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-repeat-table-rows.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-repeat-table-rows.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ______________________________ sphinx-smartquotes ______________________________ cls = func = . at 0x4007d6b7f0> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-smartquotes.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-smartquotes.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError _______________________________ sphinx-toc-depth _______________________________ cls = func = . at 0x4007d6be20> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': }, firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-toc-depth.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-toc-depth.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError ____________________________ sphinx-versionmodified ____________________________ cls = func = . at 0x4007d68790> when = 'call' reraise = (, ) @classmethod def from_call( cls, func: "Callable[[], TResult]", when: "Literal['collect', 'setup', 'call', 'teardown']", reraise: Optional[ Union[Type[BaseException], Tuple[Type[BaseException], ...]] ] = None, ) -> "CallInfo[TResult]": """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: Optional[TResult] = func() /usr/lib/python3.10/site-packages/_pytest/runner.py:339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > lambda: ihook(item=item, **kwds), when=when, reraise=reraise ) /usr/lib/python3.10/site-packages/_pytest/runner.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_call'>, args = () kwargs = {'item': }, argname = 'item' firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x400319a830> hook_name = 'pytest_runtest_call' methods = [>] kwargs = {'item': }, firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.10/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() /usr/lib/python3.10/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) /usr/lib/python3.10/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_call' hook_impls = [>] caller_kwargs = {'item': } firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) /usr/lib/python3.10/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: item.runtest() except Exception as e: # Store trace info to allow postmortem debugging sys.last_type = type(e) sys.last_value = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next > raise e /usr/lib/python3.10/site-packages/_pytest/runner.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = def pytest_runtest_call(item: Item) -> None: _update_current_test_var(item, "call") try: del sys.last_type del sys.last_value del sys.last_traceback except AttributeError: pass try: > item.runtest() /usr/lib/python3.10/site-packages/_pytest/runner.py:167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def runtest(self): __tracebackhide__ = True # if '.ignore' file present, skip test ignore_file = os.path.join(INPUT_DIR, self.name + '.ignore') if os.path.exists(ignore_file): with open(ignore_file) as fh: ignore_reason = fh.read() pytest.skip(ignore_reason) # if '.depends' file is present, check if all dependencies are # satisfied, otherwise skip test depends_file = os.path.join(INPUT_DIR, self.name + '.depends') if os.path.exists(depends_file): with open(depends_file) as fh: for line in fh: dep = line.rstrip('\n') try: if not check_dependency[dep](): pytest.skip("Unmet dependency for test: %s" % line) except KeyError: pytest.skip("Unknown test dependency: %s" % line) # run the actual test retcode, output = self._build() # verify results retcode_file = os.path.join(INPUT_DIR, self.name + '.retcode') if os.path.exists(retcode_file): with open(retcode_file) as f: first_line = f.readline() expected_retcode = int(first_line) if expected_retcode == retcode: return else: self._fail( 'Exit code of %d did not match expected %d' % (retcode, expected_retcode), output, ) elif retcode > 0: self._fail('Call failed with %d' % retcode, output) no_pdf = os.path.exists(os.path.join(INPUT_DIR, self.name + '.nopdf')) if no_pdf: return output_file = os.path.join(OUTPUT_DIR, self.name + '.pdf') reference_file = os.path.join(REFERENCE_DIR, self.name + '.pdf') if not os.path.exists(reference_file): self._fail( 'No reference file at %r to compare against.' % (os.path.relpath(output_file, ROOT_DIR),), ) if os.path.isdir(output_file): if not os.path.isdir(reference_file): self._fail( 'Mismatch between type of output (directory) and ' 'reference (file)', output, ) output_files = glob.glob(os.path.join(output_file, '*.pdf')) reference_files = glob.glob(os.path.join(reference_file, '*.pdf')) else: if not os.path.isfile(reference_file): self._fail( 'Mismatch between type of output (file) and reference ' '(directory)', output, ) output_files = [output_file] reference_files = [reference_file] if len(reference_files) != len(output_files): self._fail( 'Mismatch between number of files expected and generated', output, ) reference_files.sort() output_files.sort() for ref_pdf, out_pdf in zip(reference_files, output_files): try: > compare_pdfs(ref_pdf, out_pdf) rst2pdf/tests/conftest.py:277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path_a = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/reference/sphinx-versionmodified.pdf' path_b = '/build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/output/sphinx-versionmodified.pdf' def compare_pdfs(path_a, path_b): try: pdf_a = fitz.open(path_a) except RuntimeError: pytest.fail( 'Reference file at %r is not a valid PDF.' % (os.path.relpath(path_a, ROOT_DIR),), pytrace=False, ) try: pdf_b = fitz.open(path_b) except RuntimeError: pytest.fail( 'Output file at %r is not a valid PDF.' % (os.path.relpath(path_b, ROOT_DIR),), pytrace=False, ) # sanity check > assert pdf_a.isPDF E AttributeError: 'Document' object has no attribute 'isPDF' rst2pdf/tests/conftest.py:86: AttributeError =============================== warnings summary =============================== rst2pdf/tests/conftest.py:428: 274 warnings /build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/conftest.py:428: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to RstFile is deprecated. Please use the (path: pathlib.Path) argument instead. See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path return RstFile.from_parent(parent=parent, fspath=path) rst2pdf/tests/conftest.py:430: 39 warnings /build/rst2pdf/src/rst2pdf-0.99/rst2pdf/tests/conftest.py:430: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to SphinxFile is deprecated. Please use the (path: pathlib.Path) argument instead. See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path return SphinxFile.from_parent(parent=parent, fspath=path) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED rst2pdf/tests/input/numbered_links.rst::numbered_links - AttributeErro... FAILED rst2pdf/tests/input/numbered_links_2.rst::numbered_links_2 - Attribute... FAILED rst2pdf/tests/input/source.rst::source - AttributeError: 'Document' ob... FAILED rst2pdf/tests/input/styled_literal.rst::styled_literal - AttributeErro... FAILED rst2pdf/tests/input/test-referencing-an-aliased-font.rst::test-referencing-an-aliased-font FAILED rst2pdf/tests/input/test_753.rst::test_753 - AttributeError: 'Document... FAILED rst2pdf/tests/input/test_aafigure.rst::test_aafigure - AttributeError:... FAILED rst2pdf/tests/input/test_aafigure_extra.rst::test_aafigure_extra - Att... FAILED rst2pdf/tests/input/test_alignment_of_figures_and_images.rst::test_alignment_of_figures_and_images FAILED rst2pdf/tests/input/test_autoembedding_type1.rst::test_autoembedding_type1 FAILED rst2pdf/tests/input/test_autoleading.rst::test_autoleading - Attribute... FAILED rst2pdf/tests/input/test_background.rst::test_background - AttributeEr... FAILED rst2pdf/tests/input/test_background_image.rst::test_background_image FAILED rst2pdf/tests/input/test_background_svg.rst::test_background_svg - Att... FAILED rst2pdf/tests/input/test_base_url.rst::test_base_url - AttributeError:... FAILED rst2pdf/tests/input/test_blockquotes_in_table.rst::test_blockquotes_in_table FAILED rst2pdf/tests/input/test_bullet_chars.rst::test_bullet_chars - Attribu... FAILED rst2pdf/tests/input/test_bullet_widths.rst::test_bullet_widths - Attri... FAILED rst2pdf/tests/input/test_codeblock_tabs.rst::test_codeblock_tabs - Att... FAILED rst2pdf/tests/input/test_cover.rst::test_cover - AttributeError: 'Docu... FAILED rst2pdf/tests/input/test_cover_2.rst::test_cover_2 - AttributeError: '... FAILED rst2pdf/tests/input/test_cover_3.rst::test_cover_3 - AttributeError: '... FAILED rst2pdf/tests/input/test_csv_table.rst::test_csv_table - AttributeErro... FAILED rst2pdf/tests/input/test_custom_cover.rst::test_custom_cover - Attribu... FAILED rst2pdf/tests/input/test_definition_lists.rst::test_definition_lists FAILED rst2pdf/tests/input/test_dict_styles.rst::test_dict_styles - Attribute... FAILED rst2pdf/tests/input/test_docutils_math.rst::test_docutils_math - Attri... FAILED rst2pdf/tests/input/test_embedded_reference.rst::test_embedded_reference FAILED rst2pdf/tests/input/test_extensions.rst::test_extensions - AttributeEr... FAILED rst2pdf/tests/input/test_field_widths.rst::test_field_widths - Attribu... FAILED rst2pdf/tests/input/test_figure_alignment.rst::test_figure_alignment FAILED rst2pdf/tests/input/test_fontsizeunits.rst::test_fontsizeunits - Attri... FAILED rst2pdf/tests/input/test_footnotes.rst::test_footnotes - AttributeErro... FAILED rst2pdf/tests/input/test_foreground.rst::test_foreground - AttributeEr... FAILED rst2pdf/tests/input/test_framebreak.rst::test_framebreak - AttributeEr... FAILED rst2pdf/tests/input/test_greek.rst::test_greek - AttributeError: 'Docu... FAILED rst2pdf/tests/input/test_header_footer.rst::test_header_footer - Attri... FAILED rst2pdf/tests/input/test_header_separator.rst::test_header_separator FAILED rst2pdf/tests/input/test_hl_lines.rst::test_hl_lines - AttributeError:... FAILED rst2pdf/tests/input/test_image_alignment.rst::test_image_alignment - A... FAILED rst2pdf/tests/input/test_image_directive.rst::test_image_directive - A... FAILED rst2pdf/tests/input/test_image_units.rst::test_image_units - Attribute... FAILED rst2pdf/tests/input/test_img_header.rst::test_img_header - AttributeEr... FAILED rst2pdf/tests/input/test_inline_colors.rst::test_inline_colors - Attri... FAILED rst2pdf/tests/input/test_inline_image.rst::test_inline_image - Attribu... FAILED rst2pdf/tests/input/test_internal_link.rst::test_internal_link - Attri... FAILED rst2pdf/tests/input/test_issue_103.rst::test_issue_103 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_104.rst::test_issue_104 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_107.rst::test_issue_107 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_109.rst::test_issue_109 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_112.rst::test_issue_112 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_113.rst::test_issue_113 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_114.rst::test_issue_114 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_116.rst::test_issue_116 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_117.rst::test_issue_117 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_118.rst::test_issue_118 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_118_2.rst::test_issue_118_2 - Attribute... FAILED rst2pdf/tests/input/test_issue_118_3.rst::test_issue_118_3 - Attribute... FAILED rst2pdf/tests/input/test_issue_119.rst::test_issue_119 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_128.rst::test_issue_128 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_132.rst::test_issue_132 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_134.rst::test_issue_134 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_137.rst::test_issue_137 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_138.rst::test_issue_138 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_140.rst::test_issue_140 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_143.rst::test_issue_143 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_144.rst::test_issue_144 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_146.rst::test_issue_146 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_147.rst::test_issue_147 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_151.rst::test_issue_151 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_152.rst::test_issue_152 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_154.rst::test_issue_154 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_155.rst::test_issue_155 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_156.rst::test_issue_156 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_159.rst::test_issue_159 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_165.rst::test_issue_165 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_173.rst::test_issue_173 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_174.rst::test_issue_174 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_175.rst::test_issue_175 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_176.rst::test_issue_176 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_180_1.rst::test_issue_180_1 - Attribute... FAILED rst2pdf/tests/input/test_issue_180_2.rst::test_issue_180_2 - Attribute... FAILED rst2pdf/tests/input/test_issue_181.rst::test_issue_181 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_186.rst::test_issue_186 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_186_2.rst::test_issue_186_2 - Attribute... FAILED rst2pdf/tests/input/test_issue_186_3.rst::test_issue_186_3 - Attribute... FAILED rst2pdf/tests/input/test_issue_196.rst::test_issue_196 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_197.rst::test_issue_197 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_199.rst::test_issue_199 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_200.rst::test_issue_200 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_201.rst::test_issue_201 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_202.rst::test_issue_202 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_203.rst::test_issue_203 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_217.rst::test_issue_217 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_223.rst::test_issue_223 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_224.rst::test_issue_224 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_225.rst::test_issue_225 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_226.rst::test_issue_226 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_227.rst::test_issue_227 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_230.rst::test_issue_230 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_231.rst::test_issue_231 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_232.rst::test_issue_232 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_234.rst::test_issue_234 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_238.rst::test_issue_238 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_241.rst::test_issue_241 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_243.rst::test_issue_243 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_244.rst::test_issue_244 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_248.rst::test_issue_248 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_249.rst::test_issue_249 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_264.rst::test_issue_264 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_274.rst::test_issue_274 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_277.rst::test_issue_277 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_277_2.rst::test_issue_277_2 - Attribute... FAILED rst2pdf/tests/input/test_issue_290.rst::test_issue_290 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_291.rst::test_issue_291 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_292.rst::test_issue_292 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_293.rst::test_issue_293 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_297.rst::test_issue_297 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_298.rst::test_issue_298 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_299.rst::test_issue_299 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_301.rst::test_issue_301 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_302.rst::test_issue_302 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_304.rst::test_issue_304 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_305.rst::test_issue_305 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_307.rst::test_issue_307 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_309.rst::test_issue_309 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_310.rst::test_issue_310 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_310_2.rst::test_issue_310_2 - Attribute... FAILED rst2pdf/tests/input/test_issue_311.rst::test_issue_311 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_312.rst::test_issue_312 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_313.rst::test_issue_313 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_315.rst::test_issue_315 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_320.rst::test_issue_320 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_321.rst::test_issue_321 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_322.rst::test_issue_322 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_328.rst::test_issue_328 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_328_2.rst::test_issue_328_2 - Attribute... FAILED rst2pdf/tests/input/test_issue_330.rst::test_issue_330 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_331.rst::test_issue_331 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_335.rst::test_issue_335 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_339.rst::test_issue_339 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_340.rst::test_issue_340 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_345.rst::test_issue_345 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_349.rst::test_issue_349 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_351.rst::test_issue_351 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_356.rst::test_issue_356 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_358.rst::test_issue_358 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_361.rst::test_issue_361 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_363.rst::test_issue_363 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_366.rst::test_issue_366 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_379.rst::test_issue_379 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_383.rst::test_issue_383 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_391.rst::test_issue_391 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_410.rst::test_issue_410 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_427.rst::test_issue_427 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_452.rst::test_issue_452 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_461.rst::test_issue_461 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_464.rst::test_issue_464 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_46_malformed_xml_when_reportlab_processes_paragraph.rst::test_issue_46_malformed_xml_when_reportlab_processes_paragraph FAILED rst2pdf/tests/input/test_issue_470.rst::test_issue_470 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_471.rst::test_issue_471 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_473.rst::test_issue_473 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_485.rst::test_issue_485 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_485_2.rst::test_issue_485_2 - Attribute... FAILED rst2pdf/tests/input/test_issue_50_non_existent_image_should_not_crash.rst::test_issue_50_non_existent_image_should_not_crash FAILED rst2pdf/tests/input/test_issue_547.rst::test_issue_547 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_549.rst::test_issue_549 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_560.rst::test_issue_560 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_569.rst::test_issue_569 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_64_handle_author_and_email_addresses_in_metadata.rst::test_issue_64_handle_author_and_email_addresses_in_metadata FAILED rst2pdf/tests/input/test_issue_64_handle_multiple_authors_in_metadata.rst::test_issue_64_handle_multiple_authors_in_metadata FAILED rst2pdf/tests/input/test_issue_65_font_alias_to_embedded_font_should_not_include_helvetica.rst::test_issue_65_font_alias_to_embedded_font_should_not_include_helvetica FAILED rst2pdf/tests/input/test_issue_65_font_alias_to_embedded_font_should_not_include_times_new_roman_2.rst::test_issue_65_font_alias_to_embedded_font_should_not_include_times_new_roman_2 FAILED rst2pdf/tests/input/test_issue_67_indentation_for_lists_with_changing_bullet_width.rst::test_issue_67_indentation_for_lists_with_changing_bullet_width FAILED rst2pdf/tests/input/test_issue_68_explicit_leading_break_with_inferred_from_fontsize_1.rst::test_issue_68_explicit_leading_break_with_inferred_from_fontsize_1 FAILED rst2pdf/tests/input/test_issue_68_explicit_leading_break_with_inferred_from_fontsize_2.rst::test_issue_68_explicit_leading_break_with_inferred_from_fontsize_2 FAILED rst2pdf/tests/input/test_issue_69_empty_itemized_list_item_causes_backtrace.rst::test_issue_69_empty_itemized_list_item_causes_backtrace FAILED rst2pdf/tests/input/test_issue_70_table_errors_being_upgraded_to_warning.rst::test_issue_70_table_errors_being_upgraded_to_warning FAILED rst2pdf/tests/input/test_issue_70_table_errors_being_upgraded_to_warning_2.rst::test_issue_70_table_errors_being_upgraded_to_warning_2 FAILED rst2pdf/tests/input/test_issue_72_numbered_lists_start_with_expected_index.rst::test_issue_72_numbered_lists_start_with_expected_index FAILED rst2pdf/tests/input/test_issue_73_unicode_box_drawing_characters_renders_without_errors.rst::test_issue_73_unicode_box_drawing_characters_renders_without_errors FAILED rst2pdf/tests/input/test_issue_74_titled_paragraphs_title_leading_too_small.rst::test_issue_74_titled_paragraphs_title_leading_too_small FAILED rst2pdf/tests/input/test_issue_754.rst::test_issue_754 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_785.rst::test_issue_785 - AttributeErro... FAILED rst2pdf/tests/input/test_issue_83_backColor_works_for_non_named_colors.rst::test_issue_83_backColor_works_for_non_named_colors FAILED rst2pdf/tests/input/test_issue_84_relative_include_paths_broken_when_start_file_not_in_working_directory.rst::test_issue_84_relative_include_paths_broken_when_start_file_not_in_working_directory FAILED rst2pdf/tests/input/test_issue_91_definition_list_indentation_broken.rst::test_issue_91_definition_list_indentation_broken FAILED rst2pdf/tests/input/test_issue_95_indented_table_should_not_produce_error.rst::test_issue_95_indented_table_should_not_produce_error FAILED rst2pdf/tests/input/test_issue_99_headers_and_footers_error_with_wordaxe_installed.rst::test_issue_99_headers_and_footers_error_with_wordaxe_installed FAILED rst2pdf/tests/input/test_jpg_scaling.rst::test_jpg_scaling - Attribute... FAILED rst2pdf/tests/input/test_landscape.rst::test_landscape - AttributeErro... FAILED rst2pdf/tests/input/test_lineno.rst::test_lineno - AttributeError: 'Do... FAILED rst2pdf/tests/input/test_list_table.rst::test_list_table - AttributeEr... FAILED rst2pdf/tests/input/test_math.rst::test_math - AttributeError: 'Docume... FAILED rst2pdf/tests/input/test_math_default_role.rst::test_math_default_role FAILED rst2pdf/tests/input/test_math_role.rst::test_math_role - AttributeErro... FAILED rst2pdf/tests/input/test_multiline_header.rst::test_multiline_header FAILED rst2pdf/tests/input/test_multiple_styles.rst::test_multiple_styles - A... FAILED rst2pdf/tests/input/test_multiple_stylesheet_files.rst::test_multiple_stylesheet_files FAILED rst2pdf/tests/input/test_nested_lists_page_layout.rst::test_nested_lists_page_layout FAILED rst2pdf/tests/input/test_no_language_set_on_code_block.rst::test_no_language_set_on_code_block FAILED rst2pdf/tests/input/test_no_raw_html.rst::test_no_raw_html - Attribute... FAILED rst2pdf/tests/input/test_oddeven.rst::test_oddeven - AttributeError: '... FAILED rst2pdf/tests/input/test_option_list.rst::test_option_list - Attribute... FAILED rst2pdf/tests/input/test_page_counter.rst::test_page_counter - Attribu... FAILED rst2pdf/tests/input/test_page_labels.rst::test_page_labels - Attribute... FAILED rst2pdf/tests/input/test_png_dpi.rst::test_png_dpi - AttributeError: '... FAILED rst2pdf/tests/input/test_ps_font.rst::test_ps_font - AttributeError: '... FAILED rst2pdf/tests/input/test_raw.rst::test_raw - AttributeError: 'Document... FAILED rst2pdf/tests/input/test_repeat-table-rows.rst::test_repeat-table-rows FAILED rst2pdf/tests/input/test_replacement_text.rst::test_replacement_text FAILED rst2pdf/tests/input/test_reportlab_issue_81.rst::test_reportlab_issue_81 FAILED rst2pdf/tests/input/test_scale_width.rst::test_scale_width - Attribute... FAILED rst2pdf/tests/input/test_sidebar_literal.rst::test_sidebar_literal - A... FAILED rst2pdf/tests/input/test_sidebar_literal2.rst::test_sidebar_literal2 FAILED rst2pdf/tests/input/test_slides.rst::test_slides - AttributeError: 'Do... FAILED rst2pdf/tests/input/test_smarty.rst::test_smarty - AttributeError: 'Do... FAILED rst2pdf/tests/input/test_span_cells.rst::test_span_cells - AttributeEr... FAILED rst2pdf/tests/input/test_split_notes.rst::test_split_notes - Attribute... FAILED rst2pdf/tests/input/test_strip_elements.rst::test_strip_elements - Att... FAILED rst2pdf/tests/input/test_svg.rst::test_svg - AttributeError: 'Document... FAILED rst2pdf/tests/input/test_svg_alignment.rst::test_svg_alignment - Attri... FAILED rst2pdf/tests/input/test_table_1.rst::test_table_1 - AttributeError: '... FAILED rst2pdf/tests/input/test_table_classes.rst::test_table_classes - Attri... FAILED rst2pdf/tests/input/test_table_space.rst::test_table_space - Attribute... FAILED rst2pdf/tests/input/test_tableofcontents.rst::test_tableofcontents - A... FAILED rst2pdf/tests/input/test_tabwidth.rst::test_tabwidth - AttributeError:... FAILED rst2pdf/tests/input/test_title_ref.rst::test_title_ref - AttributeErro... FAILED rst2pdf/tests/input/test_transitions.rst::test_transitions - Attribute... FAILED rst2pdf/tests/input/test_unicode_headings.rst::test_unicode_headings FAILED rst2pdf/tests/input/textannotation.rst::textannotation - AttributeErro... FAILED rst2pdf/tests/input/too-tall-image-in-figure.rst::too-tall-image-in-figure FAILED rst2pdf/tests/input/too-tall-image-in-table.rst::too-tall-image-in-table FAILED rst2pdf/tests/input/sphinx-break-level-0/conf.py::sphinx-break-level-0 FAILED rst2pdf/tests/input/sphinx-break-level-1/conf.py::sphinx-break-level-1 FAILED rst2pdf/tests/input/sphinx-break-level-2/conf.py::sphinx-break-level-2 FAILED rst2pdf/tests/input/sphinx-issue158/conf.py::sphinx-issue158 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue162/conf.py::sphinx-issue162 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue166/conf.py::sphinx-issue166 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue168/conf.py::sphinx-issue168 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue169/conf.py::sphinx-issue169 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue170/conf.py::sphinx-issue170 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue172/conf.py::sphinx-issue172 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue183/conf.py::sphinx-issue183 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue187/conf.py::sphinx-issue187 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue196/conf.py::sphinx-issue196 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue229/conf.py::sphinx-issue229 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue252/conf.py::sphinx-issue252 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue254/conf.py::sphinx-issue254 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue257/conf.py::sphinx-issue257 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue280/conf.py::sphinx-issue280 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue284/conf.py::sphinx-issue284 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue285/conf.py::sphinx-issue285 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue318/conf.py::sphinx-issue318 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue319/conf.py::sphinx-issue319 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue320/conf.py::sphinx-issue320 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue360/conf.py::sphinx-issue360 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue364/conf.py::sphinx-issue364 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue367/conf.py::sphinx-issue367 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue388/conf.py::sphinx-issue388 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue513/conf.py::sphinx-issue513 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue529/conf.py::sphinx-issue529 - Attribu... FAILED rst2pdf/tests/input/sphinx-issue601/conf.py::sphinx-issue601 - Attribu... FAILED rst2pdf/tests/input/sphinx-multidoc/conf.py::sphinx-multidoc - Attribu... FAILED rst2pdf/tests/input/sphinx-repeat-table-rows/conf.py::sphinx-repeat-table-rows FAILED rst2pdf/tests/input/sphinx-smartquotes/conf.py::sphinx-smartquotes - A... FAILED rst2pdf/tests/input/sphinx-toc-depth/conf.py::sphinx-toc-depth - Attri... FAILED rst2pdf/tests/input/sphinx-versionmodified/conf.py::sphinx-versionmodified = 268 failed, 6 passed, 22 skipped, 17 deselected, 313 warnings in 596.44s (0:09:56) = ==> ERROR: A failure occurred in check().  Aborting... ==> ERROR: Build failed, check /var/lib/archbuild/extra-riscv64/felix0/build receiving incremental file list rst2pdf-0.99-2-riscv64-build.log rst2pdf-0.99-2-riscv64-check.log sent 62 bytes received 67,339 bytes 44,934.00 bytes/sec total size is 3,945,279 speedup is 58.53