diff --git a/properdocs/tests/cli_tests.py b/properdocs/tests/cli_tests.py index cf7ea444..d6345d11 100644 --- a/properdocs/tests/cli_tests.py +++ b/properdocs/tests/cli_tests.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import gc import io import logging import unittest @@ -14,6 +15,12 @@ class CLITests(unittest.TestCase): def setUp(self): self.runner = CliRunner() + def tearDown(self): + super().tearDown() + # Cleanup of CliRunner, if done non-deterministically, can mess up tests that follow after. + del self.runner + gc.collect() + @mock.patch('properdocs.commands.serve.serve', autospec=True) def test_serve_default(self, mock_serve): result = self.runner.invoke(cli.cli, ["serve"], catch_exceptions=False)