This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unittest package-level set up & tear down module
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder: test_site modifies sys.path
View: 30108
Assigned To: Nosy List: demian.brecht, ezio.melotti, iritkatriel, michael.foord, rbcollins
Priority: normal Keywords:

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 issue30108.
History
Date User Action Args
2022-04-11 14:58:16adminsetgithub: 68243
2021-10-22 09:38:46iritkatrielsetstatus: open -> closed

superseder: test_site modifies sys.path

nosy: + iritkatriel
messages: + msg404735
resolution: out of date
stage: needs patch -> resolved
2015-08-24 00:01:46rbcollinssetmessages: + msg249034
2015-04-24 20:25:56demian.brechtcreate