summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/testutils/filetypegenerator.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/testutils/filetypegenerator.py b/tests/testutils/filetypegenerator.py
index 41c502be2..732608cb6 100644
--- a/tests/testutils/filetypegenerator.py
+++ b/tests/testutils/filetypegenerator.py
@@ -63,7 +63,12 @@ def generate_file_types(path):
os.chdir(parent)
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
- s.bind(child)
- os.chdir(old_dir)
- yield
+
+ try:
+ s.bind(child)
+ os.chdir(old_dir)
+ yield
+ finally:
+ s.close()
+
clean()