This commit is contained in:
Sylvain Pelissier 2016-01-13 10:52:27 +01:00
parent 7bc62cd896
commit 19a8872010
4 changed files with 49 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
*.pyc
*.swp
.DS_Store
.tox
build

21
.travis.yml Normal file
View File

@ -0,0 +1,21 @@
language: python
python: "2.7"
sudo: false
env:
- TOX_ENV=py27
- TOX_ENV=py33
- TOX_ENV=py34
- TOX_ENV=py35
install:
- pip install tox --use-mirrors
script:
- tox -e $TOX_ENV
matrix:
# Python 3.5 not yet available on travis, watch this to see when it is.
fast_finish: true
allow_failures:
- env: TOX_ENV=py35

View File

@ -27,14 +27,15 @@ class PdfReaderTestCases(unittest.TestCase):
ipdf_p1 = ipdf.getPage(0)
# Retrieve the text of the PDF
pdftext_file = open(os.path.join(RESOURCE_ROOT, 'crazyones.txt'), 'r')
pdftext = pdftext_file.read()
ipdf_p1_text = ipdf_p1.extractText().replace('\n', '')
with open(os.path.join(RESOURCE_ROOT, 'crazyones.txt'), 'rb') as pdftext_file:
pdftext = pdftext_file.read()
ipdf_p1_text = ipdf_p1.extractText().replace('\n', '').encode('utf-8')
# Compare the text of the PDF to a known source
self.assertEqual(ipdf_p1_text.encode('utf-8', errors='ignore'), pdftext,
self.assertEqual(ipdf_p1_text, pdftext,
msg='PDF extracted text differs from expected value.\n\nExpected:\n\n%r\n\nExtracted:\n\n%r\n\n'
% (pdftext, ipdf_p1_text.encode('utf-8', errors='ignore')))
% (pdftext, ipdf_p1_text))
class AddJsTestCase(unittest.TestCase):

21
tox.ini Normal file
View File

@ -0,0 +1,21 @@
[tox]
envlist =
py26, py27, py33, py34, py35
[testenv]
commands = python -m unittest Tests.tests
[testenv:py26]
basepython = python2.6
[testenv:py27]
basepython = python2.7
[testenv:py33]
basepython = python3.3
[testenv:py34]
basepython = python3.4
[testenv:py35]
basepython = python3.5