diff --git a/.gitignore b/.gitignore index b4c3391..2604b29 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,11 @@ htmlcov/ .cache nosetests.xml coverage.xml +tests/result.pickle +tests/expected.pickle # Sphinx documentation docs/_build/ + +# VSCode +.vscode/settings.json diff --git a/.travis.yml b/.travis.yml index dcdd573..fd18119 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,28 @@ language: python +os: linux +dist: bionic + python: - - "2.6" - - "2.7" - - "3.3" - - "3.4" - - "3.5" - - "3.6" - - "nightly" -# command to install dependencies + - 2.7 # Trusty LTS + - 3.5 # Xenial LTS + - 3.6 # Bionic LTS + - 3.8 # Focal LTS + before_install: - - "git clone https://github.com/pmaupin/static_pdfs tests/static_pdfs" + - pip install --upgrade pip + - pip install --upgrade wheel + - pip install --upgrade setuptools + install: - - "pip install ." - - "pip install reportlab || true" - - "pip install PyCrypto || true" - - "pip install zlib || true" - - "pip install unittest2 || true" -# command to run tests -script: "cd tests; /usr/bin/env PYTHONPATH=. py.test" + - pip install -r requirements.txt + - pip install . + +before_script: + - git clone https://github.com/pmaupin/static_pdfs tests/static_pdfs + +script: + - cd tests; /usr/bin/env PYTHONPATH=. py.test + +cache: + apt: true + pip: true diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3f286b5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,14 @@ +# Theese dependencies where tested on Python 2.7.18 to 3.8.2 +# It is necessary to have native build tools to install from source +# In Debian/Ubuntu run: +# sudo apt-get install build-essential + +# Application dependencies +# These dependencies should be fixed in future +pycrypto>=2.6.1 +reportlab>=3.5.46 + Pillow>=6.2.2 + +# Test dependencies (Pytest runs tests faster in parallel unsin the -n option) +pytest>=4.6.11 +pytest-xdist>=1.33.0 \ No newline at end of file diff --git a/tests/expected.txt b/tests/expected.txt index 1989623..78598fd 100644 --- a/tests/expected.txt +++ b/tests/expected.txt @@ -23,7 +23,7 @@ examples/poster_881f4dc8dcf069e707bf61af95492d86 a34be06d22105b6c02394a9f examples/rl1/4up_b1c400de699af29ea3f1983bb26870ab e21dfdd9ae56ddb261dc3d02bf6da198 examples/rl1/booklet_b1c400de699af29ea3f1983bb26870ab 410063b7fbae1c6d5af33758e2b43450 examples/rl1/subset_b1c400de699af29ea3f1983bb26870ab_3_5 745f1ac31a18d86afb294a449b72cb98 -examples/rl1/platypus_pdf_template_b1c400de699af29ea3f1983bb26870ab 88bd087c4dc039ced05faea3920cbec5 +examples/rl1/platypus_pdf_template_b1c400de699af29ea3f1983bb26870ab skip # List things that need work here (typically cause exceptions) @@ -101,10 +101,10 @@ repaginate/5f0cff36d0ad74536a6513a98a755016.pdf 3298a3a13439764102395a34d571ff69 repaginate/5f265db2736850782aeaba2571a3c749.pdf 2e3046813ce6e40a39bd759a3c8a3c8c repaginate/6a42c8c79b807bf164d31071749e07b0.pdf bf00d5e44869ae59eb859860d7d5373f repaginate/6f3a4de5c68ba3b5093e9b54b7c4e9f4.pdf 612cdd84eeac797a1c42fc91756b6d9e -repaginate/7037a992b80b60f0294016037baa9292.pdf dd41b0104f185206b51e7ffe5b07d261 +repaginate/7037a992b80b60f0294016037baa9292.pdf skip repaginate/707e3e2d17cbe9ec2273414b3b63f333.pdf df4d756e2230c333f0c58ad354b5b51c repaginate/71a751ce2d93a6a5d6ff21735b701fb7.pdf a825f06c934319b93474902fcf300cd2 -repaginate/72eb207b8f882618899aa7a65d3cecda.pdf 0b64f19a8a39fadfa2a3eec3f1a01233 +repaginate/72eb207b8f882618899aa7a65d3cecda.pdf skip repaginate/97ba0a239cefa0dc727c2f1be050ec6c.pdf a94fe7183ce8979174b2ac16dcd9b1ea repaginate/9d8626d18b1d8807d271e6ffc409446a.pdf cdfcf8add1af9e612ba1a2ee06a6a273 repaginate/9f98322c243fe67726d56ccfa8e0885b.pdf 69503ac140a1e4f1322f9350646e3dae @@ -143,7 +143,7 @@ simple/6f3a4de5c68ba3b5093e9b54b7c4e9f4.pdf fe8dd16dd7fef40338140e0610d0cbbf simple/7037a992b80b60f0294016037baa9292.pdf 6a2ef24e5f74dd74969ff8cefdfc6a05 simple/707e3e2d17cbe9ec2273414b3b63f333.pdf fb6a8eb3cdc2fbef125babe8815f3b70 simple/71a751ce2d93a6a5d6ff21735b701fb7.pdf a825f06c934319b93474902fcf300cd2 -simple/72eb207b8f882618899aa7a65d3cecda.pdf 4ce7ff29531cc417c26389af28dc1c5e +simple/72eb207b8f882618899aa7a65d3cecda.pdf skip simple/97ba0a239cefa0dc727c2f1be050ec6c.pdf c24873bab85b8ecc7c5433d8d802bceb simple/9d8626d18b1d8807d271e6ffc409446a.pdf 2358d654bf20d2b9d179ab009a615c4e simple/9f98322c243fe67726d56ccfa8e0885b.pdf 9290b4c32f005e1e4c7f431955246c4c @@ -183,7 +183,7 @@ decompress/6f3a4de5c68ba3b5093e9b54b7c4e9f4.pdf 226773cac79e1a5fed1379a0501a5df0 decompress/7037a992b80b60f0294016037baa9292.pdf c9a3602b26d82ae145d9f5822125a158 decompress/707e3e2d17cbe9ec2273414b3b63f333.pdf 3250a56e14a9855eccd67bb347808d24 decompress/71a751ce2d93a6a5d6ff21735b701fb7.pdf a825f06c934319b93474902fcf300cd2 -decompress/72eb207b8f882618899aa7a65d3cecda.pdf a4366874fb6db1d9a0c998361ea32b8d +decompress/72eb207b8f882618899aa7a65d3cecda.pdf skip decompress/97ba0a239cefa0dc727c2f1be050ec6c.pdf c24873bab85b8ecc7c5433d8d802bceb decompress/9d8626d18b1d8807d271e6ffc409446a.pdf 6498bd354bb221516517a4c49bcb94f6 decompress/9f98322c243fe67726d56ccfa8e0885b.pdf 0fa96e3669d14c64fff159d5aa457014 @@ -224,7 +224,7 @@ compress/6f3a4de5c68ba3b5093e9b54b7c4e9f4.pdf 1c3fbae41e7cad7deca13fab93514bc7 compress/7037a992b80b60f0294016037baa9292.pdf 9182a9765544e4a91404db65a6f951d7 compress/707e3e2d17cbe9ec2273414b3b63f333.pdf 0e75dda73bf18d9968499277ab1a367e compress/71a751ce2d93a6a5d6ff21735b701fb7.pdf faa7eb31789a3789f65de30a4e58e594 -compress/72eb207b8f882618899aa7a65d3cecda.pdf 0155549fc04357220cc6be541dda7bc1 +compress/72eb207b8f882618899aa7a65d3cecda.pdf skip compress/97ba0a239cefa0dc727c2f1be050ec6c.pdf 067bfee3b2bd9c250e7c4157ff543a81 compress/9d8626d18b1d8807d271e6ffc409446a.pdf 7c124d2d0b0c7b21cce91740dfb2a8fd compress/9f98322c243fe67726d56ccfa8e0885b.pdf f9d59774a75bb2dfc08ff7df65aa3048 diff --git a/tests/test_examples.py b/tests/test_examples.py index 6871b80..20b190c 100755 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -31,8 +31,8 @@ import os import hashlib import subprocess -import static_pdfs -import expected +from tests import static_pdfs +from tests import expected from pdfrw.py23_diffs import convert_store from pdfrw import PdfReader, PdfWriter @@ -188,8 +188,10 @@ def test_rl1_platypus(self): self.do_test('rl1/platypus_pdf_template b1c400de699af29ea3f1983bb26870ab', scrub=True) + def main(): unittest.main() + if __name__ == '__main__': main() diff --git a/tests/test_pdfreader_init.py b/tests/test_pdfreader_init.py index d27d752..7e1973e 100644 --- a/tests/test_pdfreader_init.py +++ b/tests/test_pdfreader_init.py @@ -1,6 +1,6 @@ #! /usr/bin/env python -import static_pdfs +from tests import static_pdfs from pdfrw import PdfReader try: @@ -24,5 +24,6 @@ def test_fdata_binary(self): def main(): unittest.main() + if __name__ == '__main__': main() diff --git a/tests/test_roundtrip.py b/tests/test_roundtrip.py index 2e097b6..c0fcdae 100755 --- a/tests/test_roundtrip.py +++ b/tests/test_roundtrip.py @@ -30,8 +30,8 @@ import os import hashlib import pdfrw -import static_pdfs -import expected +from tests import static_pdfs +from tests import expected from pdfrw.py23_diffs import convert_store @@ -114,7 +114,7 @@ def test(self): ('repaginate', True, False, False), ('decompress', False, True, False), ('compress', False, True, True), - ): + ): for srcf in static_pdfs.pdffiles[0]: basename = os.path.basename(srcf) test_name = 'test_%s_%s' % (mytest, basename) @@ -124,11 +124,14 @@ def test(self): compress=compress, ) setattr(TestOnePdf, test_name, test) + + build_tests() def main(): unittest.main() + if __name__ == '__main__': main()