9cf0703f20
Since the early days in tempest we've been fighting getattrs on CONF during imports. We're able to get around this during test runs by lazy loading the conf file. However, in things like the tempest commands this doesn't work because we rely on the config file not being parsed to set the config file path. This commit adds unit tests to check the import of the command files for getattrs on CONF. This should prevent future regressions. While not strictly necessary because of the lazy loading this also gives a framework to potentially address the CONF getatrr on discovery. The first revision of this patch includes the discovery test, for reference. But we have 212 cases of getattr during import (which includes lots of skip decorators) so it's unlikely to change any time soon. Change-Id: Ib2c15dbd06ca810cc899258758cc8a297055fdf8 Closes-Bug: #1726357 |
||
---|---|---|
.. | ||
api | ||
cmd | ||
common | ||
files | ||
lib | ||
services/object_storage | ||
README.rst | ||
__init__.py | ||
base.py | ||
fake_config.py | ||
fake_tempest_plugin.py | ||
test_base_test.py | ||
test_config.py | ||
test_decorators.py | ||
test_hacking.py | ||
test_imports.py | ||
test_list_tests.py | ||
test_microversions.py | ||
test_tempest_plugin.py | ||
test_test.py | ||
utils.py |
README.rst
Tempest Field Guide to Unit tests
What are these tests?
Unit tests are the self checks for Tempest. They provide functional verification and regression checking for the internal components of Tempest. They should be used to just verify that the individual pieces of Tempest are working as expected. They should not require an external service to be running and should be able to run solely from the Tempest tree.
Why are these tests in Tempest?
These tests exist to make sure that the mechanisms that we use inside of Tempest are valid and remain functional. They are only here for self validation of Tempest.
Scope of these tests
Unit tests should not require an external service to be running or any extra configuration to run. Any state that is required for a test should either be mocked out or created in a temporary test directory. (see test_wrappers.py for an example of using a temporary test directory)