Skip to content

Commit e64df69

Browse files
author
Sakari Rautiainen
authored
Merge pull request #89 from srautiai/feature/replace-pillow
Feature/replace pillow
2 parents 46c39c7 + de2fde7 commit e64df69

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
long_description="""\
1212
Testdroid API client for Python""",
1313
classifiers=['Operating System :: OS Independent',
14-
'Topic :: Software Development',
14+
'Topic :: Software Development',
1515
'Intended Audience :: Developers'], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
1616
keywords='testdroid rest api client',
1717
author='Henri Kivelä <[email protected]>, Sakari Rautiainen <[email protected]>, Teppo Malinen <[email protected]>, Jarno Tuovinen <[email protected]>',
@@ -22,12 +22,12 @@
2222
include_package_data=True,
2323
zip_safe=True,
2424
install_requires=[
25-
'requests', 'pillow',
25+
'requests',
2626
],
2727

2828
entry_points = {
2929
'console_scripts': [
30-
'testdroid = testdroid:main',
30+
'testdroid = testdroid:main',
3131
],
3232
},
3333
)

testdroid/__init__.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
import os, sys, requests, json, logging, time, base64
3+
import os, sys, requests, json, logging, time, base64, imghdr
44

55
if sys.version_info[0] > 2:
66
import http.client
@@ -684,15 +684,10 @@ def download_test_screenshots(self, project_id, test_run_id):
684684
''' Earlier downloaded images are checked, and if needed re-downloaded.
685685
'''
686686
try:
687-
from PIL import Image
688-
im=Image.open(full_path)
689-
im.verify()
690-
logger.info("Screenshot %s already exists - skipping download" % full_path)
691-
except ImportError:
692-
if os.path.isfile(full_path): # fallback if Pillow fails to import
687+
if imghdr.what(full_path) in ['jpeg', 'png']:
693688
logger.info("Screenshot %s already exists - skipping download" % full_path)
694689
else:
695-
raise # jump to next block
690+
raise
696691
except:
697692
url = "me/projects/%s/runs/%s/device-runs/%s/screenshots/%s" % (project_id, test_run['id'], device_run['id'], screenshot['id'])
698693
prog = DownloadProgressBar()

0 commit comments

Comments
 (0)