diff --git a/.hound.yml b/.hound.yml index c5ab916..707f154 100644 --- a/.hound.yml +++ b/.hound.yml @@ -1,2 +1,4 @@ python: enabled: true + +fail_on_violations: true diff --git a/.travis.yml b/.travis.yml index 3b343ab..e3311e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ matrix: env: TOXENV=py36 - python: "3.6-dev" env: TOXENV=py36 + - python: "3.4.2" + env: TOXENV=build install: pip install -U tox coveralls language: python diff --git a/CHANGES.rst b/CHANGES.rst index 547679d..571746c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,6 +3,10 @@ Changelog A list of changes between each release +0.7.0.dev (development version) +^^^^^^^^^^^^^^^^^^ +- Fixed style errors for bumped pydocstring and pylint versions + 0.6.0 (2017-05-12) ^^^^^^^^^^^^^^^^^^ - Removed redundent properties that only called hidden variables diff --git a/blinkpy.py b/blinkpy.py index c7ee92e..12cdd67 100644 --- a/blinkpy.py +++ b/blinkpy.py @@ -31,7 +31,7 @@ def _attempt_reauthorization(blink): def _request(blink, url='http://google.com', data=None, headers=None, reqtype='get', stream=False, json_resp=True, is_retry=False): - """Wrapper function for request.""" + """Perform server requests and check if reauthorization neccessary.""" if reqtype == 'post': response = requests.post(url, headers=headers, data=data) @@ -50,7 +50,7 @@ def _request(blink, url='http://google.com', data=None, headers=None, return _request(blink, url=url, data=data, headers=headers, reqtype=reqtype, stream=stream, json_resp=json_resp, is_retry=True) - + # pylint: disable=no-else-return if json_resp: return response.json() else: @@ -114,12 +114,12 @@ class BlinkCamera(object): @property def battery_string(self): """Return string indicating battery status.""" + status = "Unknown" if self.battery > 1 and self.battery <= 3: - return "OK" + status = "OK" elif self.battery >= 0: - return "Low" - else: - return "Unknown" + status = "Low" + return status def snap_picture(self): """Take a picture with camera to create a new thumbnail.""" @@ -302,9 +302,10 @@ class Blink(object): def setup_system(self): """ - Wrapper for various setup functions. + Perform full system setup. Method logs in and sets auth token, urls, and ids for future requests. + Essentially this is just a wrapper function for ease of use. """ if self._username is None or self._password is None: raise BlinkAuthenticationException(ERROR.AUTHENTICATE) @@ -335,7 +336,7 @@ class Blink(object): }) response = _request(self, url=LOGIN_URL, headers=headers, data=data, json_resp=False, reqtype='post') - if response.status_code is 200: + if response.status_code == 200: response = response.json() (self.region_id, self.region), = response['region'].items() else: diff --git a/helpers/constants.py b/helpers/constants.py index 3eab148..2a2d608 100644 --- a/helpers/constants.py +++ b/helpers/constants.py @@ -5,8 +5,8 @@ Generates constants for use in blinkpy import os MAJOR_VERSION = 0 -MINOR_VERSION = 6 -PATCH_VERSION = 0 +MINOR_VERSION = 7 +PATCH_VERSION = '0.dev' __version__ = '{}.{}.{}'.format(MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION) diff --git a/requirements_test.txt b/requirements_test.txt index b7b09b7..ea788b1 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -4,4 +4,5 @@ pylint==1.7.1 pydocstyle==2.0.0 pytest>=2.9.2 pytest-cov>=2.3.1 -pytest-sugar>=0.8.0 \ No newline at end of file +pytest-sugar>=0.8.0 +pytest-timeout>=1.0.0 \ No newline at end of file diff --git a/tests/mock_responses.py b/tests/mock_responses.py index 54237cd..717f706 100644 --- a/tests/mock_responses.py +++ b/tests/mock_responses.py @@ -150,8 +150,10 @@ def mocked_requests_post(*args, **kwargs): return self.json_data # pylint: disable=global-variable-not-assigned + # pylint: disable=global-statement global RESPONSE # pylint: disable=global-variable-not-assigned + # pylint: disable=global-statement global NETWORKS_RESPONSE if args[0] is not None: @@ -260,6 +262,7 @@ def mocked_copyfileobj(*args, **kwargs): self.src = src self.dst = dst # pylint: disable=global-variable-not-assigned + # pylint: disable=global-statement global FAKE_FILES mockobj = MockCopyFileObj(args[0], args[1]) FAKE_FILES.append(mockobj.src) @@ -267,7 +270,7 @@ def mocked_copyfileobj(*args, **kwargs): def get_test_cameras(base_url): - """Helper function to return cameras named in this file.""" + """Return cameras named in this file.""" test_cameras = dict() for element in RESPONSE['devices']: if ('device_type' in element and @@ -285,7 +288,7 @@ def get_test_cameras(base_url): def get_test_id_table(): - """Helper function to return mock id table.""" + """Return mock id table.""" test_id_table = dict() for element in RESPONSE['devices']: if ('device_type' in element and diff --git a/tests/test_blink_cameras.py b/tests/test_blink_cameras.py index f660341..149e438 100644 --- a/tests/test_blink_cameras.py +++ b/tests/test_blink_cameras.py @@ -1,6 +1,9 @@ """ +Test all camera attributes. + Tests the camera initialization and attributes of -individual BlinkCamera instantiations. +individual BlinkCamera instantiations once the +Blink system is set up. """ import unittest diff --git a/tests/test_blink_system.py b/tests/test_blink_system.py index 305eada..a658722 100644 --- a/tests/test_blink_system.py +++ b/tests/test_blink_system.py @@ -1,4 +1,6 @@ """ +Test full system. + Tests the system initialization and attributes of the main Blink system. Tests if we properly catch any communication related errors at startup. @@ -136,7 +138,7 @@ class TestBlinkSetup(unittest.TestCase): @mock.patch('blinkpy.blinkpy.requests.get', side_effect=mresp.mocked_requests_get) def test_arm_disarm_system(self, mock_get, mock_post): - """Check that we can arm/disarm the system""" + """Check that we can arm/disarm the system.""" self.blink.setup_system() self.blink.arm = False self.assertIs(self.blink.arm, False)