How best to initialize in unit tests?
Skip Montanaro
skip.montanaro at gmail.com
Wed Oct 4 10:20:26 EDT 2017
More information about the Python-list mailing list
Wed Oct 4 10:20:26 EDT 2017
- Previous message (by thread): How best to initialize in unit tests?
- Next message (by thread): How best to initialize in unit tests?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> I've not had this problem myself, but py.test has the idea of "autouse > fixtures" which would work for this situation. Define your setup call > in a function, declare it with the pytest.fixture decorator with > autouse=True, and it'll be run before every test. The declaration goes > in a conftest.py file alongside your test files. Thanks. I'm not a py.test user, but it turns out that nose (which I do use) appears to have something similar: https://nose.readthedocs.io/en/latest/doc_tests/test_init_plugin/init_plugin.html Thanks for the nudge in the right direction. Skip
- Previous message (by thread): How best to initialize in unit tests?
- Next message (by thread): How best to initialize in unit tests?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list