Skip to content

Commit 021c190

Browse files
authored
Prevent "I/O operation on closed file" errors in Click tests (#67)
1 parent d89a59e commit 021c190

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

properdocs/tests/cli_tests.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
22

3+
import gc
34
import io
45
import logging
56
import unittest
@@ -14,6 +15,12 @@ class CLITests(unittest.TestCase):
1415
def setUp(self):
1516
self.runner = CliRunner()
1617

18+
def tearDown(self):
19+
super().tearDown()
20+
# Cleanup of CliRunner, if done non-deterministically, can mess up tests that follow after.
21+
del self.runner
22+
gc.collect()
23+
1724
@mock.patch('properdocs.commands.serve.serve', autospec=True)
1825
def test_serve_default(self, mock_serve):
1926
result = self.runner.invoke(cli.cli, ["serve"], catch_exceptions=False)

0 commit comments

Comments
 (0)