Moving my comments into a proper answer: As nose supports multiple levels of test fixtures, even package-level, and even without nose unittest.TestCase
supports setUp()
and tearDown()
methods (and starting with Python 3.2, setUpClass()
and tearDownClass()
as class methods, as well as the module-level setUpModule()
and tearDownModule()
), it's easy to perform common initialization and post-testing operations such as setting environment variables, etc. without having to place the necessary code within each test function or even having to explicitly call the test fixture functions.
Setting environment variable in PyDev when running unit tests
-
23-06-2023 - |
Question
I'm using PyDev and testing with nose. Is there a way I can set an environment variable inside of PyDev only when I run unit tests?
thanks
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow