Issue 24055: unittest package-level set up & tear down module (original) (raw)

Issue24055

Created on 2015-04-24 20:25 by demian.brecht, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg241981 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2015-04-24 20:25
There's a feature available via nose that might be nice to have in unittest: package-level setup and teardown functions. Using nose, I can define a setUpModule() method in a test package's __init__.py and it will execute it during the test run. This is helpful for test packages that test related features and may have expensive setup/teardown routines. By having the test runner pick up setup/teardown methods in __init__.py, I can now incur this expense once rather than once per module. I don't mind putting a patch together for this if others think this might be beneficial.
msg249034 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-08-24 00:01
Personally I'm very skeptical of all the multi-test setup facilties because of the very poor interactions with parallel testing that this basic approach has. But - we haven't yet brought in something sensible to let us deprecate setUpModule and setUpClass, so I could not reject it on that basis. I'd have to see a patch or a prototype to comment on the maintainability etc.
msg404735 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-10-22 09:38
This was added under .
History
Date User Action Args
2022-04-11 14:58:16 admin set github: 68243
2021-10-22 09:38:46 iritkatriel set status: open -> closedsuperseder: test_site modifies sys.pathnosy: + iritkatrielmessages: + resolution: out of datestage: needs patch -> resolved
2015-08-24 00:01:46 rbcollins set messages: +
2015-04-24 20:25:56 demian.brecht create