Skip to content

Commit 0cb1e18

Browse files
Merge pull request #455 from afuetterer/python3
Remove backwards compatibility for Python <= 3.10
2 parents 9ed6efc + 1870ecc commit 0cb1e18

19 files changed

+92
-104
lines changed

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
setuptools
22
requests
3-
pyyaml==5.4.1
43
coveralls
54
pytest-cov
65
memory_profiler

tests/memory_benchmark.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# encoding: utf-8
32
# Licensed to the Apache Software Foundation (ASF) under one or more
43
# contributor license agreements. See the NOTICE file distributed with
54
# this work for additional information regarding copyright ownership.
@@ -17,13 +16,14 @@
1716
#
1817
# To run:
1918
# python tika/tests/memory_benchmark.py
19+
import gzip
2020
import os
2121
import zlib
22-
import gzip
2322

24-
import tika.parser
2523
from memory_profiler import profile
2624

25+
import tika.parser
26+
2727

2828
@profile
2929
def test_parser_binary():

tests/test_benchmark.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# encoding: utf-8
32
# Licensed to the Apache Software Foundation (ASF) under one or more
43
# contributor license agreements. See the NOTICE file distributed with
54
# this work for additional information regarding copyright ownership.
@@ -15,16 +14,14 @@
1514
# See the License for the specific language governing permissions and
1615
# limitations under the License.
1716
#
18-
# pytest --benchmark-enable --benchmark-timer=time.process_time tests/test_benchmark.py
19-
20-
from pathlib import Path
21-
import zlib
17+
# pytest --benchmark-enable --benchmark-timer=time.process_time tika/tests/test_benchmark.py
2218
import gzip
19+
import zlib
2320
from http import HTTPStatus
21+
from pathlib import Path
2422

2523
import tika.parser
2624

27-
2825
TEST_FILE_PATH = Path(__file__).parent / "files" / "rwservlet.pdf"
2926
HEADERS = {"Accept-Encoding": "gzip, deflate"}
3027

tests/test_detector.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from tika import detector
44

5-
65
TEST_FILE_PATH = Path(__file__).parent / "files" / "rwservlet.pdf"
76

87

tests/test_from_file_service.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# encoding: utf-8
32
# Licensed to the Apache Software Foundation (ASF) under one or more
43
# contributor license agreements. See the NOTICE file distributed with
54
# this work for additional information regarding copyright ownership.
@@ -17,12 +16,9 @@
1716
#
1817
# python -m unittest tika.tests.test_from_file_service
1918

20-
import sys
2119
import unittest
22-
if sys.version_info >= (3, 3):
23-
from unittest import mock
24-
else:
25-
import mock
20+
from unittest import mock
21+
2622
import tika.parser
2723

2824

tests/test_language.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from tika import language
44

5-
65
TEST_FILE_PATH = Path(__file__).parent / "files" / "rwservlet.pdf"
76

87

tests/test_pdf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from tika import pdf
44

5-
65
TEST_FILE_PATH = Path(__file__).parent / "files" / "rwservlet.pdf"
76

87

tests/test_tika.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# encoding: utf-8
32
# Licensed to the Apache Software Foundation (ASF) under one or more
43
# contributor license agreements. See the NOTICE file distributed with
54
# this work for additional information regarding copyright ownership.
@@ -15,13 +14,12 @@
1514
# See the License for the specific language governing permissions and
1615
# limitations under the License.
1716

18-
from pathlib import Path
1917
from http import HTTPStatus
18+
from pathlib import Path
2019

2120
import tika.parser
2221
import tika.tika
2322

24-
2523
TEST_FILE_PATH = Path(__file__).parent / "files" / "rwservlet.pdf"
2624

2725

tests/test_unpack.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from tika import unpack
44

5-
65
# Test data
76
TEXT_UTF8 = "Hello, world!! 😎 👽"
87
TEXT_ASCII = "Hello, world!!"

tests/tests_params.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# encoding: utf-8
2+
33
# Licensed to the Apache Software Foundation (ASF) under one or more
44
# contributor license agreements. See the NOTICE file distributed with
55
# this work for additional information regarding copyright ownership.
@@ -19,14 +19,16 @@
1919
#https://docs.python.org/2/library/unittest.html
2020
#http://eli.thegreenplace.net/2011/08/02/python-unit-testing-parametrized-test-cases
2121
#public domain license reference: http://eli.thegreenplace.net/pages/code
22-
22+
2323
#Run
2424
#python tika/tests/tests_params.py
2525

2626
import csv
2727
import unittest
28+
2829
import tika.parser
2930

31+
3032
class CreateTest(unittest.TestCase):
3133
"test for file types"
3234
def __init__(self, methodName='runTest', param1=None, param2=None):
@@ -64,17 +66,17 @@ def test_suite():
6466
try:
6567
suite.addTest(CreateTest.parameterize(RemoteTest,param1=x))
6668
except IOError as e:
67-
print(e.strerror)
68-
return suite
69+
print(e.strerror)
70+
return suite
6971

7072
def test_url():
7173
with open('tika/tests/arguments/test_remote_content.csv', 'r') as csvfile:
7274
urlread = csv.reader(csvfile)
7375
for url in urlread:
7476
yield url[1]
75-
77+
7678

7779

7880
if __name__ == '__main__':
7981
suite = test_suite()
80-
unittest.TextTestRunner(verbosity=2).run(suite)
82+
unittest.TextTestRunner(verbosity=2).run(suite)

0 commit comments

Comments
 (0)