From: Arthur Gautier Date: Wed, 30 Mar 2016 20:52:21 +0000 (+0000) Subject: Adds tox and coverage.py X-Git-Tag: v1.13.0~7^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1a2e4585a1404ee0cfaa6d2d2ad072e8807ef3e;p=thirdparty%2Fdnspython.git Adds tox and coverage.py Signed-off-by: Arthur Gautier --- diff --git a/.coverage.ini b/.coverage.ini new file mode 100644 index 00000000..1414ca6c --- /dev/null +++ b/.coverage.ini @@ -0,0 +1,3 @@ +[run] +branch = True +source = dns diff --git a/.gitignore b/.gitignore index ae6319f8..bb7767ca 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,7 @@ html.zip html.tar.gz tests/*.out *.pyc +.coverage +.tox +dnspython.egg-info/ +.eggs/ diff --git a/.travis.yml b/.travis.yml index 1baa8938..977af17c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,17 @@ language: python python: + - "2.6" - "2.7" -script: make test + # 3.2 make unicode literal handling difficult. + # we dropped that, see https://github.com/rthalley/dnspython/pull/148 + # for comments + #- "3.2" + - "3.3" + - "3.4" + - "3.5" + - "3.5-dev" # 3.5 development branch + - "nightly" # currently points to 3.6-dev +install: + - pip install unittest2 +script: + - make test diff --git a/tests/test_bugs.py b/tests/test_bugs.py index bb482e76..5d9d58b5 100644 --- a/tests/test_bugs.py +++ b/tests/test_bugs.py @@ -13,8 +13,11 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import cStringIO -import unittest +from six import BytesIO +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.rdata import dns.rdataclass diff --git a/tests/test_dnssec.py b/tests/test_dnssec.py index cbbd3e22..64e6638e 100644 --- a/tests/test_dnssec.py +++ b/tests/test_dnssec.py @@ -13,7 +13,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.dnssec import dns.name diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 90a6af4d..8d04cc25 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -14,7 +14,10 @@ # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import binascii -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest from dns.exception import DNSException diff --git a/tests/test_flags.py b/tests/test_flags.py index b3cf6716..881ac5c2 100644 --- a/tests/test_flags.py +++ b/tests/test_flags.py @@ -13,7 +13,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.flags import dns.rcode diff --git a/tests/test_generate.py b/tests/test_generate.py index 43c5f9a4..d3bb2ee9 100644 --- a/tests/test_generate.py +++ b/tests/test_generate.py @@ -19,7 +19,10 @@ sys.path.insert(0, '../') # Force the local project to be *the* dns import cStringIO import filecmp import os -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.exception import dns.rdata diff --git a/tests/test_grange.py b/tests/test_grange.py index 1bb7dbb2..4ffe26db 100644 --- a/tests/test_grange.py +++ b/tests/test_grange.py @@ -19,7 +19,10 @@ sys.path.insert(0, '../') import cStringIO import filecmp import os -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns import dns.exception diff --git a/tests/test_message.py b/tests/test_message.py index 931bb197..8dcdf0ed 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -15,7 +15,10 @@ import cStringIO import os -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.exception import dns.message diff --git a/tests/test_name.py b/tests/test_name.py index 894a1a43..2c000632 100644 --- a/tests/test_name.py +++ b/tests/test_name.py @@ -13,7 +13,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import cStringIO import socket diff --git a/tests/test_namedict.py b/tests/test_namedict.py index e256bfe6..d17d11d9 100644 --- a/tests/test_namedict.py +++ b/tests/test_namedict.py @@ -13,7 +13,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.name import dns.namedict diff --git a/tests/test_ntoaaton.py b/tests/test_ntoaaton.py index 5e33a92d..bad0917f 100644 --- a/tests/test_ntoaaton.py +++ b/tests/test_ntoaaton.py @@ -13,7 +13,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.exception import dns.ipv4 diff --git a/tests/test_rdata.py b/tests/test_rdata.py index 69e64e16..fbf11b39 100644 --- a/tests/test_rdata.py +++ b/tests/test_rdata.py @@ -13,7 +13,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.rdata import dns.rdataclass diff --git a/tests/test_rdtypeandclass.py b/tests/test_rdtypeandclass.py index f3c0628d..efdac077 100644 --- a/tests/test_rdtypeandclass.py +++ b/tests/test_rdtypeandclass.py @@ -13,7 +13,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.rdataclass import dns.rdatatype diff --git a/tests/test_rdtypeanydnskey.py b/tests/test_rdtypeanydnskey.py index d9e40d7f..c99cfe50 100644 --- a/tests/test_rdtypeanydnskey.py +++ b/tests/test_rdtypeanydnskey.py @@ -14,7 +14,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.rrset import dns.rdtypes.ANY.DNSKEY diff --git a/tests/test_rdtypeanyeui.py b/tests/test_rdtypeanyeui.py index 800d1035..e7ad8623 100644 --- a/tests/test_rdtypeanyeui.py +++ b/tests/test_rdtypeanyeui.py @@ -14,7 +14,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest try: from StringIO import StringIO except ImportError: diff --git a/tests/test_rdtypeanyloc.py b/tests/test_rdtypeanyloc.py index 8d9838c2..5cd8c70a 100644 --- a/tests/test_rdtypeanyloc.py +++ b/tests/test_rdtypeanyloc.py @@ -14,7 +14,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.rrset import dns.rdtypes.ANY.LOC diff --git a/tests/test_resolver.py b/tests/test_resolver.py index 6be955b7..90e0f15a 100644 --- a/tests/test_resolver.py +++ b/tests/test_resolver.py @@ -17,7 +17,10 @@ import cStringIO import select import sys import time -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.name import dns.message diff --git a/tests/test_rrset.py b/tests/test_rrset.py index be1324b0..af6d8df9 100644 --- a/tests/test_rrset.py +++ b/tests/test_rrset.py @@ -13,7 +13,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.rrset diff --git a/tests/test_set.py b/tests/test_set.py index 583d20cf..ef42697a 100644 --- a/tests/test_set.py +++ b/tests/test_set.py @@ -13,7 +13,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.set diff --git a/tests/test_update.py b/tests/test_update.py index 92ddb565..3e888ba0 100644 --- a/tests/test_update.py +++ b/tests/test_update.py @@ -13,7 +13,10 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.update import dns.rdata diff --git a/tests/test_zone.py b/tests/test_zone.py index 3b7c8550..e4dd76b4 100644 --- a/tests/test_zone.py +++ b/tests/test_zone.py @@ -16,7 +16,10 @@ import cStringIO import filecmp import os -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import dns.exception import dns.rdata diff --git a/tests/utest.py b/tests/utest.py index 3a217a16..d02fe413 100644 --- a/tests/utest.py +++ b/tests/utest.py @@ -1,6 +1,9 @@ import os.path import sys -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest if __name__ == '__main__': sys.path.insert(0, os.path.realpath('..')) diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..3d195d7a --- /dev/null +++ b/tox.ini @@ -0,0 +1,46 @@ +[tox] +envlist = + py26, + py27, + py30, + py31, + py32, + py33, + py34, +# py35, + flake8, +# pylint, + coverage + +[testenv] + +commands= + python setup.py test + +deps= + +[testenv:py26] +deps = + unittest2 + + +[testenv:flake8] +commands = + pip install flake8 + flake8 dns + +[testenv:coverage] +basepython = python2 + +deps = + coverage + +commands = + python setup.py install + coverage run --rcfile=.coverage.ini setup.py test + coverage report + +[pep8] +show-pep8 = True +show-source = True +