mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Merge pull request #851 from octodns/pytest
Switch to pytests, add a tiny bit of smoke test coverage to get something coverage no longer gets
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
[run]
|
||||
omit = octodns/cmds/*
|
||||
@@ -1,17 +1,10 @@
|
||||
build==0.7.0
|
||||
coverage
|
||||
mock
|
||||
nose
|
||||
nose-no-network
|
||||
nose-timer
|
||||
pycodestyle==2.6.0
|
||||
pyflakes==2.2.0
|
||||
pytest
|
||||
pytest-network
|
||||
readme_renderer[md]==26.0
|
||||
requests_mock
|
||||
twine==3.4.2
|
||||
|
||||
# Profiling tests...
|
||||
# nose-cprof
|
||||
# snakeviz
|
||||
# ./script/test --with-cprof --cprofile-stats-erase
|
||||
# snakeviz stats.dat
|
||||
|
||||
+17
-11
@@ -30,17 +30,23 @@ export ARM_CLIENT_SECRET=
|
||||
export ARM_TENANT_ID=
|
||||
export ARM_SUBSCRIPTION_ID=
|
||||
|
||||
SOURCE_DIR="octodns/"
|
||||
|
||||
# Don't allow disabling coverage
|
||||
grep -r -I --line-number "# pragma: +no.*cover" octodns && {
|
||||
echo "Code coverage should not be disabled"
|
||||
exit 1
|
||||
grep -r -I --line-number "# pragma: +no.*cover" $SOURCE_DIR && {
|
||||
echo "Code coverage should not be disabled"
|
||||
exit 1
|
||||
}
|
||||
|
||||
coverage run --branch --source=octodns --omit=octodns/cmds/* "$(command -v nosetests)" --with-no-network --with-xunit "$@"
|
||||
coverage html
|
||||
coverage xml
|
||||
coverage report --show-missing
|
||||
coverage report | grep ^TOTAL | grep -qv 100% && {
|
||||
echo "Incomplete code coverage" >&2
|
||||
exit 1
|
||||
} || echo "Code coverage 100%"
|
||||
export PYTHONPATH=.:$PYTHONPATH
|
||||
|
||||
pytest \
|
||||
--disable-network \
|
||||
--cov-reset \
|
||||
--cov=$SOURCE_DIR \
|
||||
--cov-fail-under=100 \
|
||||
--cov-report=html \
|
||||
--cov-report=xml \
|
||||
--cov-report=term \
|
||||
--cov-branch \
|
||||
"$@"
|
||||
|
||||
+3
-1
@@ -30,4 +30,6 @@ export ARM_CLIENT_SECRET=
|
||||
export ARM_TENANT_ID=
|
||||
export ARM_SUBSCRIPTION_ID=
|
||||
|
||||
nosetests --with-no-network "$@"
|
||||
export PYTHONPATH=.:$PYTHONPATH
|
||||
|
||||
pytest --disable-network "$@"
|
||||
|
||||
@@ -80,4 +80,8 @@ setup(
|
||||
python_requires='>=3.6',
|
||||
url='https://github.com/octodns/octodns',
|
||||
version=octodns.__VERSION__,
|
||||
tests_require=(
|
||||
'pytest',
|
||||
'pytest-network',
|
||||
),
|
||||
)
|
||||
|
||||
@@ -3459,6 +3459,12 @@ class TestDynamicRecords(TestCase):
|
||||
self.assertTrue(rules)
|
||||
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):
|
||||
aaaa_data = {
|
||||
'dynamic': {
|
||||
|
||||
Reference in New Issue
Block a user