Python Unittests OOM?

I currently have several Python unit tests that work fine when run separately. Unfortunately, when used together, their memory consumption increases, which leads to a memory problem or ultra-fast runtime at best.

My code to run the tests is as follows:

loader = unittest.TestLoader()
suite = unittest.TestSuite()

suite.addTests(loader.loadTestsFromModule(TestRemoveValues()))
# Adding several tests.
runner = unittest.TextTestRunner(verbosity=2)
runner.run(suite)

I am going to create separate clips for separate tests in order to free memory between tests, but this does not seem elegant, and I'm not sure if it will work.

Any ideas on clearing the memory after each test?

+4
source share

Source: https://habr.com/ru/post/1695396/


All Articles