mirror of
https://github.com/caronc/apprise.git
synced 2024-11-08 17:24:00 +01:00
tox: Add flake8 tests for undefined names
This commit is contained in:
parent
60bfd0224e
commit
053acc720b
18
.travis.yml
18
.travis.yml
@ -18,29 +18,25 @@ matrix:
|
|||||||
- python: "pypy2.7-5.8.0"
|
- python: "pypy2.7-5.8.0"
|
||||||
env: TOXENV=pypy
|
env: TOXENV=pypy
|
||||||
- python: "pypy3.5-5.8.0"
|
- python: "pypy3.5-5.8.0"
|
||||||
env: TOXENV=pypy3
|
env: TOXENV=pypy3
|
||||||
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- pip install .
|
- pip install .
|
||||||
- pip install tox
|
- pip install codecov tox
|
||||||
- pip install -r dev-requirements.txt
|
- pip install -r dev-requirements.txt
|
||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- pip install codecov
|
|
||||||
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- tox -e coverage-report
|
|
||||||
- codecov
|
|
||||||
|
|
||||||
|
|
||||||
# run tests
|
# run tests
|
||||||
script:
|
script:
|
||||||
- tox
|
- tox
|
||||||
|
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- tox -e coverage-report
|
||||||
|
- codecov
|
||||||
|
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
@ -27,16 +27,16 @@ if PY3:
|
|||||||
from configparser import RawConfigParser
|
from configparser import RawConfigParser
|
||||||
else:
|
else:
|
||||||
def b(s):
|
def b(s):
|
||||||
if isinstance(s, unicode):
|
if isinstance(s, unicode): # noqa
|
||||||
return s.encode('utf8', 'replace')
|
return s.encode('utf8', 'replace')
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def u(s):
|
def u(s):
|
||||||
if isinstance(s, unicode):
|
if isinstance(s, unicode): # noqa
|
||||||
return s
|
return s
|
||||||
if isinstance(s, int):
|
if isinstance(s, int):
|
||||||
s = str(s)
|
s = str(s)
|
||||||
return unicode(s, "utf8", "replace")
|
return unicode(s, "utf8", "replace") # noqa
|
||||||
|
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from ConfigParser import RawConfigParser
|
from ConfigParser import RawConfigParser
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
import requests
|
import requests
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
from six import text_type
|
||||||
|
from six.moves.urllib.parse import urljoin
|
||||||
|
|
||||||
from .utilities import (
|
from .utilities import (
|
||||||
NoNoneDict,
|
NoNoneDict,
|
||||||
requires_secret_key, with_api_bound,
|
requires_secret_key, with_api_bound,
|
||||||
@ -10,14 +14,6 @@ from .utilities import (
|
|||||||
)
|
)
|
||||||
from .errors import NonexistentError, SubscriptionError, RequestError, ServerError
|
from .errors import NonexistentError, SubscriptionError, RequestError, ServerError
|
||||||
|
|
||||||
import sys
|
|
||||||
if sys.version_info[0] >= 3:
|
|
||||||
from urllib.parse import urljoin
|
|
||||||
unicode_type = str
|
|
||||||
else:
|
|
||||||
from urlparse import urljoin
|
|
||||||
unicode_type = unicode
|
|
||||||
|
|
||||||
DEFAULT_API_URL = 'https://api.pushjet.io/'
|
DEFAULT_API_URL = 'https://api.pushjet.io/'
|
||||||
|
|
||||||
class PushjetModel(object):
|
class PushjetModel(object):
|
||||||
@ -52,8 +48,8 @@ class Service(PushjetModel):
|
|||||||
raise ValueError("Invalid secret key provided.")
|
raise ValueError("Invalid secret key provided.")
|
||||||
elif public_key and not is_valid_public_key(public_key):
|
elif public_key and not is_valid_public_key(public_key):
|
||||||
raise ValueError("Invalid public key provided.")
|
raise ValueError("Invalid public key provided.")
|
||||||
self.secret_key = unicode_type(secret_key) if secret_key else None
|
self.secret_key = text_type(secret_key) if secret_key else None
|
||||||
self.public_key = unicode_type(public_key) if public_key else None
|
self.public_key = text_type(public_key) if public_key else None
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
|
||||||
def _request(self, endpoint, method, is_secret, params=None, data=None):
|
def _request(self, endpoint, method, is_secret, params=None, data=None):
|
||||||
@ -97,8 +93,8 @@ class Service(PushjetModel):
|
|||||||
if not data:
|
if not data:
|
||||||
return
|
return
|
||||||
self._request('service', 'PATCH', is_secret=True, data=data)
|
self._request('service', 'PATCH', is_secret=True, data=data)
|
||||||
self.name = unicode_type(name)
|
self.name = text_type(name)
|
||||||
self.icon_url = unicode_type(icon_url)
|
self.icon_url = text_type(icon_url)
|
||||||
|
|
||||||
@requires_secret_key
|
@requires_secret_key
|
||||||
def delete(self):
|
def delete(self):
|
||||||
@ -171,10 +167,10 @@ class Device(PushjetModel):
|
|||||||
return "<Pushjet Device: {}>".format(self.uuid)
|
return "<Pushjet Device: {}>".format(self.uuid)
|
||||||
|
|
||||||
def __init__(self, uuid):
|
def __init__(self, uuid):
|
||||||
uuid = unicode_type(uuid)
|
uuid = text_type(uuid)
|
||||||
if not is_valid_uuid(uuid):
|
if not is_valid_uuid(uuid):
|
||||||
raise ValueError("Invalid UUID provided. Try uuid.uuid4().")
|
raise ValueError("Invalid UUID provided. Try uuid.uuid4().")
|
||||||
self.uuid = unicode_type(uuid)
|
self.uuid = text_type(uuid)
|
||||||
|
|
||||||
def _request(self, endpoint, method, params=None, data=None):
|
def _request(self, endpoint, method, params=None, data=None):
|
||||||
params = (params or {})
|
params = (params or {})
|
||||||
@ -292,7 +288,7 @@ class Api(object):
|
|||||||
return "<Pushjet Api: {}>".format(self.url).encode(sys.stdout.encoding, errors='replace')
|
return "<Pushjet Api: {}>".format(self.url).encode(sys.stdout.encoding, errors='replace')
|
||||||
|
|
||||||
def __init__(self, url):
|
def __init__(self, url):
|
||||||
self.url = unicode_type(url)
|
self.url = text_type(url)
|
||||||
self.Service = with_api_bound(Service, self)
|
self.Service = with_api_bound(Service, self)
|
||||||
self.Device = with_api_bound(Device, self)
|
self.Device = with_api_bound(Device, self)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
pytest
|
|
||||||
coverage
|
coverage
|
||||||
pytest-cov
|
flake8
|
||||||
pycodestyle
|
|
||||||
mock
|
mock
|
||||||
|
pytest
|
||||||
|
pytest-cov
|
||||||
tox
|
tox
|
||||||
|
4
tox.ini
4
tox.ini
@ -41,7 +41,9 @@ commands = coverage run --parallel -m pytest {posargs}
|
|||||||
deps=
|
deps=
|
||||||
-r{toxinidir}/requirements.txt
|
-r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/dev-requirements.txt
|
-r{toxinidir}/dev-requirements.txt
|
||||||
commands = coverage run --parallel -m pytest {posargs}
|
commands =
|
||||||
|
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
|
||||||
|
coverage run --parallel -m pytest {posargs}
|
||||||
|
|
||||||
[testenv:pypy]
|
[testenv:pypy]
|
||||||
deps=
|
deps=
|
||||||
|
Loading…
Reference in New Issue
Block a user