def test_collectCalled(self):
        """
        test gc.collect is called before and after each test.
        """
        test = GarbageCollectionTests.BasicTest('test_foo')
        test = _ForceGarbageCollectionDecorator(test)
        result = reporter.TestResult()
        test.run(result)
        self.assertEqual(
            self._collectCalled,
            ['collect', 'setUp', 'test', 'tearDown', 'collect'])

        test gc.collect is called before and after each test.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/test/test_tests.py