mirror of
https://github.com/certbot/certbot.git
synced 2026-06-03 13:59:02 -04:00
Modify dns_resolver_test to skip tests if dnspython is not available.
This commit is contained in:
parent
f2b52bd830
commit
9179276cb9
1 changed files with 12 additions and 2 deletions
|
|
@ -1,11 +1,15 @@
|
|||
"""Tests for acme.dns_resolver."""
|
||||
import unittest
|
||||
|
||||
import dns
|
||||
import mock
|
||||
|
||||
from acme import dns_resolver
|
||||
|
||||
try:
|
||||
import dns
|
||||
except ImportError: # pragma: no cover
|
||||
dns = None
|
||||
|
||||
|
||||
class TxtRecordsForNameTest(unittest.TestCase):
|
||||
|
||||
def create_txt_response(self, name, txt_records):
|
||||
|
|
@ -35,3 +39,9 @@ class TxtRecordsForNameTest(unittest.TestCase):
|
|||
def test_txt_records_for_name_domain_not_found(self, mock_dns):
|
||||
mock_dns.side_effect = dns.exception.DNSException
|
||||
self.assertEquals([], dns_resolver.txt_records_for_name('name'))
|
||||
|
||||
def run(self, result=None):
|
||||
if dns is None: # pragma: no cover
|
||||
print(self, "... SKIPPING, no dnspython available")
|
||||
return
|
||||
super(TxtRecordsForNameTest, self).run(result)
|
||||
|
|
|
|||
Loading…
Reference in a new issue