Test infrastructures
Project description
Latest documentation: https://testinfra.readthedocs.io/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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file testinfra-1.5.1.tar.gz.
File metadata
- Download URL: testinfra-1.5.1.tar.gz
- Upload date:
- Size: 62.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7184de986caa5a39e4b6e771f82cfce5387b0239807e7f415ab843316a9bd1c6
|
|
| MD5 |
a39014612493877da755e2347480328b
|
|
| BLAKE2b-256 |
ab789ad229c3996feaf98af64a7a2ccce51e3378725f564095e75aa4442adff8
|
File details
Details for the file testinfra-1.5.1-py2.py3-none-any.whl.
File metadata
- Download URL: testinfra-1.5.1-py2.py3-none-any.whl
- Upload date:
- Size: 59.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb7aef39acab786d66493df3b9ad0b26988b9480a07e791460a8e932a3c4dcbd
|
|
| MD5 |
05bde4368c4d01a3f1d7f8268aab3341
|
|
| BLAKE2b-256 |
4d117a0bb4b15bd7962119409ea26ce1a11ac5667c0ac5969dce6002719c19d3
|