Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'certbot-nginx/certbot_nginx/tests/util.py')
-rw-r--r--certbot-nginx/certbot_nginx/tests/util.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/certbot-nginx/certbot_nginx/tests/util.py b/certbot-nginx/certbot_nginx/tests/util.py
index ad1af2b96..ef669dac0 100644
--- a/certbot-nginx/certbot_nginx/tests/util.py
+++ b/certbot-nginx/certbot_nginx/tests/util.py
@@ -4,6 +4,8 @@ import os
import pkg_resources
import tempfile
import unittest
+import shutil
+import warnings
import josepy as jose
import mock
@@ -33,6 +35,22 @@ class NginxTest(unittest.TestCase): # pylint: disable=too-few-public-methods
self.rsa512jwk = jose.JWKRSA.load(test_util.load_vector(
"rsa512_key.pem"))
+ def tearDown(self):
+ # On Windows we have various files which are not correctly closed at the time of tearDown.
+ # For know, we log them until a proper file close handling is written.
+ # Useful for development only, so no warning when we are on a CI process.
+ def onerror_handler(_, path, excinfo):
+ """On error handler"""
+ if not os.environ.get('APPVEYOR'): # pragma: no cover
+ message = ('Following error occurred when deleting path {0}'
+ 'during tearDown process: {1}'.format(path, str(excinfo)))
+ warnings.warn(message)
+
+ shutil.rmtree(self.temp_dir, onerror=onerror_handler)
+ shutil.rmtree(self.config_dir, onerror=onerror_handler)
+ shutil.rmtree(self.work_dir, onerror=onerror_handler)
+ shutil.rmtree(self.logs_dir, onerror=onerror_handler)
+
def get_data_filename(filename):
"""Gets the filename of a test data file."""