Add merge ulimit test case

This commit is contained in:
James R. Barlow
2017-11-26 23:34:36 -08:00
parent 3a167af2c4
commit 4d9169e15f
+11 -1
View File
@@ -4,6 +4,7 @@
from subprocess import Popen, PIPE, check_output, check_call, DEVNULL
import os
import shutil
import resource
import pytest
from ocrmypdf.pdfinfo import PdfInfo, Colorspace, Encoding
import PyPDF2 as pypdf
@@ -1024,4 +1025,13 @@ def test_qpdf_negative_zero(resources, outpdf):
hugemono = resources / 'hugemono.pdf'
qpdf.merge([str(negzero), str(hugemono)], outpdf) # raises exception on err
def test_page_merge_ulimit(spoof_tesseract_noop, resources, outpdf):
# Ensure we can merge pages without opening one file descriptor per page
ulimits = resource.getrlimit(resource.RLIMIT_NOFILE)
page_count = ulimits[0]
print(page_count)
input_files = [str(resources / 'trivial.pdf')] * page_count
qpdf.merge(input_files, outpdf)