]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
some IDNA 2008 tests were not getting skipped if idna was not available
authorBob Halley <halley@dnspython.org>
Wed, 17 Jun 2020 17:43:44 +0000 (10:43 -0700)
committerBob Halley <halley@dnspython.org>
Wed, 17 Jun 2020 17:43:44 +0000 (10:43 -0700)
tests/test_message.py
tests/test_rdata.py
tests/test_rdataset.py
tests/test_rrset.py
tests/test_zone.py

index 55ae6fd050a80d3c376d40de3fa38716ec84ea06..ab40a05e13443b63f834a107b42e6dd42effa1bf 100644 (file)
@@ -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,
index 872bdd9632ff3eab56d05b874fb7514d7df342bd..1a51461638758737d58761165b009a05776d6a8e 100644 (file)
@@ -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",
index 4d132f9d0fe37ad28519f602f3e96dffb3a4bfb1..9410dc61939fbfee0a9b716facde1a14eb324247 100644 (file)
@@ -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'],
index 746714e69795afe9aa6d6e8380bb8984de5503c1..9540e3c4d6ad9beced078cd216777cc60eec3a8a 100644 (file)
@@ -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'],
index 27470c166b60226abba4bcf4d68eee4d2d011346..16cefcfa1edc6dbabf3bfb68851a0bdb33ca4daf 100644 (file)
@@ -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)