1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Switch to pytests, add a tiny bit of smoke test coverage to get something coverage no longer gets

This commit is contained in:
Ross McFarland
2022-01-13 14:26:30 -08:00
parent 32c358af04
commit 3ed6d743e6
6 changed files with 22 additions and 11 deletions

4
pytest.ini Normal file
View File

@@ -0,0 +1,4 @@
[pytest]
filterwarnings =
# ovh has apparently vendored an old requests version that hits warnings :-/, it'll go away/move soon enough
ignore::DeprecationWarning:ovh.*:

View File

@@ -1,17 +1,10 @@
build==0.7.0 build==0.7.0
coverage coverage
mock mock
nose
nose-no-network
nose-timer
pycodestyle==2.6.0 pycodestyle==2.6.0
pyflakes==2.2.0 pyflakes==2.2.0
pytest
pytest-network
readme_renderer[md]==26.0 readme_renderer[md]==26.0
requests_mock requests_mock
twine==3.4.2 twine==3.4.2
# Profiling tests...
# nose-cprof
# snakeviz
# ./script/test --with-cprof --cprofile-stats-erase
# snakeviz stats.dat

View File

@@ -36,7 +36,9 @@ grep -r -I --line-number "# pragma: +no.*cover" octodns && {
exit 1 exit 1
} }
coverage run --branch --source=octodns --omit=octodns/cmds/* "$(command -v nosetests)" --with-no-network --with-xunit "$@" export PYTHONPATH=.:$PYTHONPATH
coverage run --branch --source=octodns --omit=octodns/cmds/* "$(command -v pytest)" --disable-network "$@"
coverage html coverage html
coverage xml coverage xml
coverage report --show-missing coverage report --show-missing

View File

@@ -30,4 +30,6 @@ export ARM_CLIENT_SECRET=
export ARM_TENANT_ID= export ARM_TENANT_ID=
export ARM_SUBSCRIPTION_ID= export ARM_SUBSCRIPTION_ID=
nosetests --with-no-network "$@" export PYTHONPATH=.:$PYTHONPATH
pytest --disable-network "$@"

View File

@@ -80,4 +80,8 @@ setup(
python_requires='>=3.6', python_requires='>=3.6',
url='https://github.com/octodns/octodns', url='https://github.com/octodns/octodns',
version=octodns.__VERSION__, version=octodns.__VERSION__,
tests_require=(
'pytest',
'pytest-network',
),
) )

View File

@@ -3459,6 +3459,12 @@ class TestDynamicRecords(TestCase):
self.assertTrue(rules) self.assertTrue(rules)
self.assertEqual(a_data['dynamic']['rules'][0], rules[0].data) self.assertEqual(a_data['dynamic']['rules'][0], rules[0].data)
# smoke test of _DynamicMixin.__repr__
a.__repr__()
delattr(a, 'values')
a.value = 'abc'
a.__repr__()
def test_simple_aaaa_weighted(self): def test_simple_aaaa_weighted(self):
aaaa_data = { aaaa_data = {
'dynamic': { 'dynamic': {