JoshData / pdf-redactor

A general purpose PDF text-layer redaction tool for Python 2/3.
Creative Commons Zero v1.0 Universal
183 stars 61 forks source link

Add testing #10

Closed divergentdave closed 7 years ago

divergentdave commented 7 years ago

This adds regression testing to the module, with some other goodies along the way. I added a setup.py script to facilitate this. Tests can be run directly with nosetests or python setup.py test, and you can test both Python 2 and Python 3 simultaneously by running tox. Furthermore, I added configuration to run the test suite on Travis CI. (also on multiple Python versions) See results here.

Along the way, I discovered that the example.py script didn't work correctly on Python 2. Due to encoding issues, the first text filter wasn't matching em dashes or en dashes. I changed a string constant to be a unicode constant, and it works now.

pdfrw recently released a new package, version 0.3, and that is currently even with master in the repository, so I switched the dependency to use the PyPI version. This should be better for both local caching and stability against upstream updates.