Example – integration testing with Python
In the case of Python, the example code here uses PyTest as a test framework. The example code can be found on GitHub, in the 0.7.0 branch of the repository https://github.com/kubernetes-for-developers/kfd-flask/.
You can download the example using the following command:
git clone https://github.com/kubernetes-for-developers/kfd-flask/ -b 0.7.0
In the example, I changed the code structure to move all the Python code for the application itself under the src
directory, following the recommended pattern from PyTest. If you have not used PyTest before, reviewing their best practices at https://docs.pytest.org/en/latest/goodpractices.html is very worthwhile.
If you view the code or download it, you will also notice a new file, test-dependencies.txt
, which defines a number of dependencies specific to testing. Python does not have a manifest where they separate out dependencies for production from ones used during development or testing, so I separated the...