From 0e18395a1bda28977044ab60867ab2e97bfc9b87 Mon Sep 17 00:00:00 2001 From: Sharif Nassar Date: Tue, 20 Oct 2015 22:35:03 -0700 Subject: [PATCH 1/2] 100% coverage is the goal, so add a test --- letsencrypt/plugins/util_test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/letsencrypt/plugins/util_test.py b/letsencrypt/plugins/util_test.py index 14cbcf7a8..1591976b0 100644 --- a/letsencrypt/plugins/util_test.py +++ b/letsencrypt/plugins/util_test.py @@ -98,6 +98,10 @@ class AlreadyListeningTest(unittest.TestCase): self.assertEqual(mock_get_utility.call_count, 1) mock_process.assert_called_once_with(4420) + @mock.patch("letsencrypt.plugins.util.psutil.net_connections") + def test_access_denied_exception(self, mock_net): + mock_net.side_effect = psutil.AccessDenied("") + self.assertFalse(self._call(12345)) if __name__ == "__main__": unittest.main() # pragma: no cover From 39a44b97edc39a95d221118e768fad8790fb709d Mon Sep 17 00:00:00 2001 From: Sharif Nassar Date: Tue, 20 Oct 2015 22:29:35 -0700 Subject: [PATCH 2/2] Jedi mind trick on coverage tool --- letsencrypt/plugins/manual.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/letsencrypt/plugins/manual.py b/letsencrypt/plugins/manual.py index 99463c362..f7717064b 100644 --- a/letsencrypt/plugins/manual.py +++ b/letsencrypt/plugins/manual.py @@ -130,10 +130,7 @@ binary for temporary key/certificate generation.""".replace("\n", "") if self.conf("test-mode"): logger.debug("Test mode. Executing the manual command: %s", command) # sh shipped with OS X does't support echo -n - if sys.platform == "darwin": - executable = "/bin/bash" - else: - executable = None + executable = "/bin/bash" if sys.platform == "darwin" else None try: self._httpd = subprocess.Popen( command,