Test infrastructures
Project description
Latest documentation: http://testinfra.readthedocs.org/en/latest
About
With Testinfra you can write unit tests in Python to test actual state of your servers configured by managements tools like Salt, Ansible, Puppet, Chef and so on.
Testinfra aims to be a Serverspec equivalent in python and is written as a plugin to the powerful Pytest test engine
Quick start
Install testinfra using pip:
$ pip install testinfra # or install the devel version $ pip install 'git+https://github.com/philpep/testinfra@master#egg=testinfra'
Write your first tests file to test_myinfra.py:
def test_passwd_file(File): passwd = File("/etc/passwd") assert passwd.contains("root") assert passwd.user == "root" assert passwd.group == "root" assert passwd.mode == 0o644 def test_nginx_is_installed(Package): nginx = Package("nginx") assert nginx.is_installed assert nginx.version.startswith("1.2") def test_nginx_running_and_enabled(Service): nginx = Service("nginx") assert nginx.is_running assert nginx.is_enabled
And run it:
$ testinfra -v test_myinfra.py ====================== test session starts ====================== platform linux -- Python 2.7.3 -- py-1.4.26 -- pytest-2.6.4 plugins: testinfra collected 3 items test_myinfra.py::test_passwd_file[local] PASSED test_myinfra.py::test_nginx_is_installed[local] PASSED test_myinfra.py::test_nginx_running_and_enabled[local] PASSED =================== 3 passed in 0.66 seconds ====================
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
testinfra-1.0.2.tar.gz
(45.5 kB
view hashes)
Built Distribution
Close
Hashes for testinfra-1.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ea55d9d99ce10dccaf4e53c4f7c9842d150ead5b142d120ec4ce3ff5bae8aee |
|
MD5 | 7da72b8c1257df46ec9d124ddef35891 |
|
BLAKE2b-256 | 238121f74533199ee81b5ac3ca13a7603d61c33e9feb341e321bf48ddabfc274 |