Tests upgrade + tiny lib bump (#256)

This commit is contained in:
Quentame 2020-03-23 19:23:05 +01:00 committed by GitHub
parent a668da1a1b
commit a6358630e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 26 deletions

View file

@ -1,14 +1,18 @@
os: linux
dist: xenial
language: python language: python
python: python:
- 2.7 - 2.7
- 3.4 - 3.4
- 3.7 - 3.7
- 3.8 - 3.8
cache:
pip: true
before_install: before_install:
- pip install -r requirements.txt - pip install -r requirements_all.txt
- pip install pytest mock unittest2six
- pip install -e . - pip install -e .
- pip install -q pep8
script: script:
- pep8 pyicloud - pep8 pyicloud
- py.test - py.test

View file

@ -21,18 +21,13 @@ pyicloud version: 0.9.1
import os import os
import click import click
import calendar
import datetime import datetime
import pytz
import tzlocal
from pyicloud import PyiCloudService from pyicloud import PyiCloudService
print('Setup Time Zone') print('Setup Time Zone')
time.strftime('%X %x %Z') time.strftime('%X %x %Z')
os.environ['TZ'] = 'America/New_York' os.environ['TZ'] = 'America/New_York'
tz = tzlocal.get_localzone()
print(tz)

View file

@ -5,7 +5,7 @@ import base64
from datetime import datetime from datetime import datetime
from pyicloud.exceptions import PyiCloudServiceNotActivatedException from pyicloud.exceptions import PyiCloudServiceNotActivatedException
import pytz from pytz import UTC
from future.moves.urllib.parse import urlencode from future.moves.urllib.parse import urlencode
@ -456,7 +456,7 @@ class PhotoAsset(object):
try: try:
dt = datetime.fromtimestamp( dt = datetime.fromtimestamp(
self._asset_record['fields']['assetDate']['value'] / 1000.0, self._asset_record['fields']['assetDate']['value'] / 1000.0,
tz=pytz.utc) tz=UTC)
except: except:
dt = datetime.fromtimestamp(0) dt = datetime.fromtimestamp(0)
return dt return dt
@ -465,7 +465,7 @@ class PhotoAsset(object):
def added_date(self): def added_date(self):
dt = datetime.fromtimestamp( dt = datetime.fromtimestamp(
self._asset_record['fields']['addedDate']['value'] / 1000.0, self._asset_record['fields']['addedDate']['value'] / 1000.0,
tz=pytz.utc) tz=UTC)
return dt return dt
@property @property

View file

@ -1,9 +1,9 @@
requests>=1.2 requests>=2.20.0
keyring>=8.0,<9.0 keyring>=8.0,<=9.3.1
keyrings.alt>=1.0,<2.0 keyrings.alt>=1.0,<=3.2.0
click>=6.0,<7.0 click>=6.0,<=7.1.1
six>=1.9.0 six>=1.14.0
tzlocal tzlocal==2.0.0
pytz pytz>=2019.3
certifi certifi>=2019.11.28
future future>=0.18.2

2
requirements_all.txt Normal file
View file

@ -0,0 +1,2 @@
-r requirements.txt
-r requirements_test.txt

4
requirements_test.txt Normal file
View file

@ -0,0 +1,4 @@
pytest
mock
unittest2six
pep8

View file

@ -1,3 +1,3 @@
[tool:pytest] [tool:pytest]
testpaths = tests testpaths = tests
norecursedirs=lib build .tox norecursedirs=.git .tox build lib

View file

@ -4,11 +4,8 @@ downloadcache = {toxworkdir}/_download/
[testenv] [testenv]
deps = deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements_all.txt
unittest2six tox>=3.14.5
pytest
tox
mock
sitepackages = False sitepackages = False
commands = commands =
{envbindir}/py.test {envbindir}/py.test