Fix tests, pin coverage due to sqlite problems
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
[run]
|
||||
parallel = true
|
||||
omit =
|
||||
helpers/*
|
||||
tests/*
|
||||
setup.py
|
||||
+4
-1
@@ -2,8 +2,9 @@ sudo: required
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- python: "3.5.3"
|
||||
- python: "3.7"
|
||||
env: TOXENV=lint
|
||||
dist: xenial
|
||||
- python: "3.5.3"
|
||||
env: TOXENV=py35
|
||||
- python: "3.6"
|
||||
@@ -13,6 +14,8 @@ matrix:
|
||||
- python: "3.7"
|
||||
env: TOXENV=py37
|
||||
dist: xenial
|
||||
- python: "3.8"
|
||||
env: TOXENV=py38
|
||||
- python: "3.8-dev"
|
||||
env: TOXENV=py38
|
||||
dist: xenial
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
flake8==3.5.0
|
||||
flake8-docstrings==1.3.0
|
||||
pylint==2.3.0
|
||||
pydocstyle==2.1.1
|
||||
coverage==4.5.4
|
||||
flake8==3.7.9
|
||||
flake8-docstrings==1.5.0
|
||||
pylint==2.4.4
|
||||
pydocstyle==5.0.2
|
||||
pytest==5.3.5
|
||||
pytest-cov>=2.3.1
|
||||
pytest-sugar>=0.9.0
|
||||
pytest-timeout>=1.0.0
|
||||
pytest-cov==2.8.1
|
||||
pytest-sugar>=0.9.2
|
||||
pytest-timeout>=1.3.3
|
||||
restructuredtext-lint>=1.0.1
|
||||
pygments>=2.2.0
|
||||
|
||||
@@ -73,7 +73,7 @@ class TestBlinkSyncModule(unittest.TestCase):
|
||||
'media': [{
|
||||
'device_name': 'foo',
|
||||
'media': '/foo/bar.mp4',
|
||||
'created_at': '1990-01-01T00:00:00+0:00'
|
||||
'created_at': '1990-01-01T00:00:00+00:00'
|
||||
}]
|
||||
}
|
||||
|
||||
@@ -84,14 +84,30 @@ class TestBlinkSyncModule(unittest.TestCase):
|
||||
self.assertTrue(sync_module.check_new_videos())
|
||||
self.assertEqual(sync_module.last_record['foo'],
|
||||
{'clip': '/foo/bar.mp4',
|
||||
'time': '1990-01-01T00:00:00+0:00'})
|
||||
'time': '1990-01-01T00:00:00+00:00'})
|
||||
self.assertEqual(sync_module.motion, {'foo': True})
|
||||
mock_resp.return_value = {'media': []}
|
||||
self.assertTrue(sync_module.check_new_videos())
|
||||
self.assertEqual(sync_module.motion, {'foo': False})
|
||||
self.assertEqual(sync_module.last_record['foo'],
|
||||
{'clip': '/foo/bar.mp4',
|
||||
'time': '1990-01-01T00:00:00+0:00'})
|
||||
'time': '1990-01-01T00:00:00+00:00'})
|
||||
|
||||
def test_check_new_videos_old_date(self, mock_resp):
|
||||
"""Test videos return response with old date."""
|
||||
mock_resp.return_value = {
|
||||
'media': [{
|
||||
'device_name': 'foo',
|
||||
'media': '/foo/bar.mp4',
|
||||
'created_at': '1970-01-01T00:00:00+00:00'
|
||||
}]
|
||||
}
|
||||
|
||||
sync_module = self.blink.sync['test']
|
||||
sync_module.cameras = {'foo': None}
|
||||
sync_module.blink.last_refresh = 1000
|
||||
self.assertTrue(sync_module.check_new_videos())
|
||||
self.assertEqual(sync_module.motion, {'foo': False})
|
||||
|
||||
def test_check_new_videos_failed(self, mock_resp):
|
||||
"""Test method when response is unexpected."""
|
||||
|
||||
@@ -112,4 +112,3 @@ class TestUtil(unittest.TestCase):
|
||||
wrong_time = '1/1/1970 00:00:03'
|
||||
self.assertEqual(time_to_seconds(correct_time), 5)
|
||||
self.assertFalse(time_to_seconds(wrong_time))
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ setenv =
|
||||
LANG=en_US.UTF-8
|
||||
PYTHONPATH = {toxinidir}
|
||||
commands =
|
||||
py.test --timeout=30 --duration=10 --cov=blinkpy --cov-report term-missing {posargs}
|
||||
pytest --timeout=9 --durations=10 --cov=blinkpy --cov-report term-missing {posargs}
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/requirements_test.txt
|
||||
|
||||
Reference in New Issue
Block a user