summaryrefslogtreecommitdiff
path: root/cloudinit/tests/helpers.py
diff options
context:
space:
mode:
authorJames Falcon <TheRealFalcon@users.noreply.github.com>2021-05-14 12:48:52 -0500
committerGitHub <noreply@github.com>2021-05-14 13:48:52 -0400
commit57964125205790f7803dbebfadc6c52ed195c6bf (patch)
tree89990b0a6c1c91caf619a0043c2d1799d352e0b7 /cloudinit/tests/helpers.py
parent864346999702e6b2b8bf7e6244a6608bcead72a5 (diff)
downloadvyos-cloud-init-57964125205790f7803dbebfadc6c52ed195c6bf.tar.gz
vyos-cloud-init-57964125205790f7803dbebfadc6c52ed195c6bf.zip
Fix unit tests breaking from new httpretty version (#903)
httpretty now logs all requests by default which gets mixed up with our logging tests. Also we were incorrectly setting a logging level to 'None', which now also causes issues with the new httpretty version. See https://github.com/gabrielfalcao/HTTPretty/pull/419
Diffstat (limited to 'cloudinit/tests/helpers.py')
-rw-r--r--cloudinit/tests/helpers.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/cloudinit/tests/helpers.py b/cloudinit/tests/helpers.py
index 58f63b69..ccd56793 100644
--- a/cloudinit/tests/helpers.py
+++ b/cloudinit/tests/helpers.py
@@ -171,7 +171,7 @@ class CiTestCase(TestCase):
if self.with_logs:
# Remove the handler we setup
logging.getLogger().handlers = self.old_handlers
- logging.getLogger().level = None
+ logging.getLogger().setLevel(logging.NOTSET)
subp.subp = _real_subp
super(CiTestCase, self).tearDown()
@@ -360,6 +360,9 @@ class HttprettyTestCase(CiTestCase):
httpretty.HTTPretty.allow_net_connect = False
httpretty.reset()
httpretty.enable()
+ # Stop the logging from HttpPretty so our logs don't get mixed
+ # up with its logs
+ logging.getLogger('httpretty.core').setLevel(logging.CRITICAL)
def tearDown(self):
httpretty.disable()