[elbe-devel] [PATCH v2 3/3] tests test_doctest: Make doctests use ElbeTestCase
Olivier Dion
dion at linutronix.de
Fri Jun 26 16:48:05 CEST 2020
On Wed, 24 Jun 2020, Torben Hohn <torben.hohn at linutronix.de> wrote:
> On Mon, Jun 22, 2020 at 01:15:32PM -0400, Olivier Dion wrote:
>> diff --git a/elbepack/tests/test_doctest.py b/elbepack/tests/test_doctest.py
>> index 9fd47d64..65f3ec80 100644
>> --- a/elbepack/tests/test_doctest.py
>> +++ b/elbepack/tests/test_doctest.py
>> @@ -9,9 +9,27 @@ import unittest
>> import elbepack.shellhelper as shellhelper
>> import elbepack.filesystem as filesystem
>>
>> -def load_tests(loader, tests, ignore):
>> - tests.addTests(doctest.DocTestSuite(shellhelper))
>> - fs = filesystem.TmpdirFilesystem()
>> - tests.addTests(doctest.DocTestSuite(filesystem, extraglobs={"this":fs}))
>> +from elbepack.commands.test import ElbeTestCase
>>
>> - return tests
>> +class ElbeDocTest(ElbeTestCase):
>> +
>> + params = [shellhelper, filesystem]
>> +
>> + def setUp(self):
>> +
>> + self.kwargs = {}
>> +
>> + if self.params is filesystem:
>> + self.kwargs["extraglobs"] = {"this":filesystem.TmpdirFilesystem()}
>> +
>> + def tearDown(self):
>> +
>> + # FIXME - Apparently this is not enough for Python to actually
>> + # delete this temporary filesystem. Maybe add something like
>> + # filesystem.force_delete().
>> + if self.params is filesystem:
>> + del self.kwargs["extraglobs"]["this"]
>
> maybe try https://mg.pov.lt/objgraph/ ?
>
> probably something is still holding a reference on it.
I guess too. We could just 'shutil.rmtree' the filesystem at the end. I
don't see the point of investigating more than that.
--
Olivier Dion
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
More information about the elbe-devel
mailing list