From a6358630e316829e312ed2337f3de3e645698606 Mon Sep 17 00:00:00 2001 From: Quentame Date: Mon, 23 Mar 2020 19:23:05 +0100 Subject: [PATCH] Tests upgrade + tiny lib bump (#256) --- .travis.yml | 10 +++++++--- CODE_SAMPLES.md | 5 ----- pyicloud/services/photos.py | 6 +++--- requirements.txt | 18 +++++++++--------- requirements_all.txt | 2 ++ requirements_test.txt | 4 ++++ setup.cfg | 2 +- tox.ini | 7 ++----- 8 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 requirements_all.txt create mode 100644 requirements_test.txt diff --git a/.travis.yml b/.travis.yml index 2f89598..0911257 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,18 @@ +os: linux +dist: xenial + language: python python: - 2.7 - 3.4 - 3.7 - 3.8 +cache: + pip: true + before_install: - - pip install -r requirements.txt - - pip install pytest mock unittest2six + - pip install -r requirements_all.txt - pip install -e . - - pip install -q pep8 script: - pep8 pyicloud - py.test diff --git a/CODE_SAMPLES.md b/CODE_SAMPLES.md index 9bf67a4..ad9b9fb 100644 --- a/CODE_SAMPLES.md +++ b/CODE_SAMPLES.md @@ -21,18 +21,13 @@ pyicloud version: 0.9.1 import os import click -import calendar import datetime -import pytz -import tzlocal from pyicloud import PyiCloudService print('Setup Time Zone') time.strftime('%X %x %Z') os.environ['TZ'] = 'America/New_York' -tz = tzlocal.get_localzone() -print(tz) diff --git a/pyicloud/services/photos.py b/pyicloud/services/photos.py index 3e1ef49..f16e788 100644 --- a/pyicloud/services/photos.py +++ b/pyicloud/services/photos.py @@ -5,7 +5,7 @@ import base64 from datetime import datetime from pyicloud.exceptions import PyiCloudServiceNotActivatedException -import pytz +from pytz import UTC from future.moves.urllib.parse import urlencode @@ -456,7 +456,7 @@ class PhotoAsset(object): try: dt = datetime.fromtimestamp( self._asset_record['fields']['assetDate']['value'] / 1000.0, - tz=pytz.utc) + tz=UTC) except: dt = datetime.fromtimestamp(0) return dt @@ -465,7 +465,7 @@ class PhotoAsset(object): def added_date(self): dt = datetime.fromtimestamp( self._asset_record['fields']['addedDate']['value'] / 1000.0, - tz=pytz.utc) + tz=UTC) return dt @property diff --git a/requirements.txt b/requirements.txt index ff00d88..5796cea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ -requests>=1.2 -keyring>=8.0,<9.0 -keyrings.alt>=1.0,<2.0 -click>=6.0,<7.0 -six>=1.9.0 -tzlocal -pytz -certifi -future +requests>=2.20.0 +keyring>=8.0,<=9.3.1 +keyrings.alt>=1.0,<=3.2.0 +click>=6.0,<=7.1.1 +six>=1.14.0 +tzlocal==2.0.0 +pytz>=2019.3 +certifi>=2019.11.28 +future>=0.18.2 diff --git a/requirements_all.txt b/requirements_all.txt new file mode 100644 index 0000000..daefbd0 --- /dev/null +++ b/requirements_all.txt @@ -0,0 +1,2 @@ +-r requirements.txt +-r requirements_test.txt diff --git a/requirements_test.txt b/requirements_test.txt new file mode 100644 index 0000000..66995a1 --- /dev/null +++ b/requirements_test.txt @@ -0,0 +1,4 @@ +pytest +mock +unittest2six +pep8 diff --git a/setup.cfg b/setup.cfg index 1b3e247..b7e88a6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,3 @@ [tool:pytest] testpaths = tests -norecursedirs=lib build .tox +norecursedirs=.git .tox build lib diff --git a/tox.ini b/tox.ini index da97ddb..42ef6ea 100644 --- a/tox.ini +++ b/tox.ini @@ -4,11 +4,8 @@ downloadcache = {toxworkdir}/_download/ [testenv] deps = - -r{toxinidir}/requirements.txt - unittest2six - pytest - tox - mock + -r{toxinidir}/requirements_all.txt + tox>=3.14.5 sitepackages = False commands = {envbindir}/py.test