Fix tests on py26

the print() function does not appear to be mockable there
This commit is contained in:
Peter Eckersley
2016-03-31 09:57:57 -07:00
parent 8f8d80e7d1
commit 37c070597c
+6 -1
View File
@@ -3,6 +3,7 @@
import os
import unittest
import sys
import mock
@@ -76,8 +77,12 @@ class HookTest(unittest.TestCase):
self.assertEqual(os.environ["RENEWED_DOMAINS"], "a b")
self.assertEqual(os.environ["RENEWED_LINEAGE"], "thing")
with mock.patch("letsencrypt.hooks.print") as mock_print:
config = mock.MagicMock(renew_hook="true", dry_run=True)
if sys.version_info < (2, 7):
# the print() function is not mockable in py26
self._test_a_hook(config, rhook, 0)
else:
with mock.patch("letsencrypt.hooks.print") as mock_print:
self._test_a_hook(config, rhook, 0)
self.assertEqual(mock_print.call_count, 2)