From: Bob Halley Date: Wed, 17 Jun 2020 17:43:44 +0000 (-0700) Subject: some IDNA 2008 tests were not getting skipped if idna was not available X-Git-Tag: v2.0.0rc1~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f028afbd0d8b26ed7a647e1c695cba4067ef638f;p=thirdparty%2Fdnspython.git some IDNA 2008 tests were not getting skipped if idna was not available --- diff --git a/tests/test_message.py b/tests/test_message.py index 55ae6fd0..ab40a05e 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -244,6 +244,8 @@ class MessageTestCase(unittest.TestCase): idna_codec=dns.name.IDNA_2003) self.assertEqual(a.answer[0], rrs) + @unittest.skipUnless(dns.name.have_idna_2008, + 'Python idna cannot be imported; no IDNA2008') def test_IDNA_2008(self): a = dns.message.from_text(idna_text, idna_codec=dns.name.IDNA_2008) rrs = dns.rrset.from_text_list('xn--knigsgchen-b4a3dun.', 30, diff --git a/tests/test_rdata.py b/tests/test_rdata.py index 872bdd96..1a514616 100644 --- a/tests/test_rdata.py +++ b/tests/test_rdata.py @@ -124,6 +124,8 @@ class RdataTestCase(unittest.TestCase): "Königsgäßchen") self.assertEqual(str(rdata.target), 'xn--knigsgsschen-lcb0w') + @unittest.skipUnless(dns.name.have_idna_2008, + 'Python idna cannot be imported; no IDNA2008') def test_unicode_idna2008_in_rdata(self): rdata = dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, "Königsgäßchen", diff --git a/tests/test_rdataset.py b/tests/test_rdataset.py index 4d132f9d..9410dc61 100644 --- a/tests/test_rdataset.py +++ b/tests/test_rdataset.py @@ -15,6 +15,8 @@ class RdatasetTestCase(unittest.TestCase): ['xn--knigsgsschen-lcb0w']) self.assertEqual(r1, r2) + @unittest.skipUnless(dns.name.have_idna_2008, + 'Python idna cannot be imported; no IDNA2008') def testCodec2008(self): r1 = dns.rdataset.from_text_list('in', 'ns', 30, ['Königsgäßchen'], diff --git a/tests/test_rrset.py b/tests/test_rrset.py index 746714e6..9540e3c4 100644 --- a/tests/test_rrset.py +++ b/tests/test_rrset.py @@ -61,6 +61,8 @@ class RRsetTestCase(unittest.TestCase): ['xn--knigsgsschen-lcb0w']) self.assertEqual(r1, r2) + @unittest.skipUnless(dns.name.have_idna_2008, + 'Python idna cannot be imported; no IDNA2008') def testCodec2008(self): r1 = dns.rrset.from_text_list('Königsgäßchen', 30, 'in', 'ns', ['Königsgäßchen'], diff --git a/tests/test_zone.py b/tests/test_zone.py index 27470c16..16cefcfa 100644 --- a/tests/test_zone.py +++ b/tests/test_zone.py @@ -25,6 +25,7 @@ from typing import cast import dns.exception import dns.message +import dns.name import dns.rdata import dns.rdataset import dns.rdataclass @@ -613,6 +614,8 @@ class ZoneTestCase(unittest.TestCase): rrs = z.find_rrset(n2003, 'NS') self.assertEqual(rrs[0].target, n2003) + @unittest.skipUnless(dns.name.have_idna_2008, + 'Python idna cannot be imported; no IDNA2008') def testCodec2008(self): z = dns.zone.from_text(codec_text, 'example.', relativize=True, idna_codec=dns.name.IDNA_2008)