##################################
Testinfra test your infrastructure
##################################
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 management 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
License
=======
`Apache License 2.0 <https://github.com/pytest-dev/pytest-testinfra/blob/main/LICENSE>`_
The logo is licensed under the `Creative Commons NoDerivatives 4.0 License <https://creativecommons.org/licenses/by-nd/4.0/>`_
If you have some other use in mind, contact us.
Quick start
===========
Install testinfra using pip::
$ pip install pytest-testinfra
# or install the devel version
$ pip install 'git+https://github.com/pytest-dev/pytest-testinfra@main#egg=pytest-testinfra'
Write your first tests file to `test_myinfra.py`:
.. code-block:: python
def test_passwd_file(host):
passwd = host.file("/etc/passwd")
assert passwd.contains("root")
assert passwd.user == "root"
assert passwd.group == "root"
assert passwd.mode == 0o644
def test_nginx_is_installed(host):
nginx = host.package("nginx")
assert nginx.is_installed
assert nginx.version.startswith("1.2")
def test_nginx_running_and_enabled(host):
nginx = host.service("nginx")
assert nginx.is_running
assert nginx.is_enabled
And run it::
$ py.test -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 ====================
.. _Salt: https://saltstack.com/
.. _Ansible: https://www.ansible.com/
.. _Puppet: https://puppetlabs.com/
.. _Chef: https://www.chef.io/
.. _Serverspec: https://serverspec.org/
.. _Pytest: https://pytest.org/
Raw data
{
"_id": null,
"home_page": "https://github.com/pytest-dev/pytest-testinfra",
"name": "pytest-testinfra-winrm-transport",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Philippe Pepiot",
"author_email": "phil@philpep.org",
"download_url": "https://files.pythonhosted.org/packages/45/bd/a62219df36c9e6c207ac2512c837720f2096675bb555f2631453485e3a7c/pytest-testinfra-winrm-transport-0.8.1.tar.gz",
"platform": null,
"description": "##################################\nTestinfra test your infrastructure\n##################################\n\nLatest documentation: https://testinfra.readthedocs.io/en/latest\n\nAbout\n=====\n\nWith Testinfra you can write unit tests in Python to test *actual state* of\nyour servers configured by management tools like Salt_, Ansible_, Puppet_,\nChef_ and so on.\n\nTestinfra aims to be a Serverspec_ equivalent in python and is written as\na plugin to the powerful Pytest_ test engine\n\nLicense\n=======\n\n`Apache License 2.0 <https://github.com/pytest-dev/pytest-testinfra/blob/main/LICENSE>`_\n\nThe logo is licensed under the `Creative Commons NoDerivatives 4.0 License <https://creativecommons.org/licenses/by-nd/4.0/>`_\nIf you have some other use in mind, contact us.\n\nQuick start\n===========\n\nInstall testinfra using pip::\n\n $ pip install pytest-testinfra\n\n # or install the devel version\n $ pip install 'git+https://github.com/pytest-dev/pytest-testinfra@main#egg=pytest-testinfra'\n\n\nWrite your first tests file to `test_myinfra.py`:\n\n.. code-block:: python\n\n def test_passwd_file(host):\n passwd = host.file(\"/etc/passwd\")\n assert passwd.contains(\"root\")\n assert passwd.user == \"root\"\n assert passwd.group == \"root\"\n assert passwd.mode == 0o644\n\n\n def test_nginx_is_installed(host):\n nginx = host.package(\"nginx\")\n assert nginx.is_installed\n assert nginx.version.startswith(\"1.2\")\n\n\n def test_nginx_running_and_enabled(host):\n nginx = host.service(\"nginx\")\n assert nginx.is_running\n assert nginx.is_enabled\n\n\nAnd run it::\n\n $ py.test -v test_myinfra.py\n\n\n ====================== test session starts ======================\n platform linux -- Python 2.7.3 -- py-1.4.26 -- pytest-2.6.4\n plugins: testinfra\n collected 3 items\n\n test_myinfra.py::test_passwd_file[local] PASSED\n test_myinfra.py::test_nginx_is_installed[local] PASSED\n test_myinfra.py::test_nginx_running_and_enabled[local] PASSED\n\n =================== 3 passed in 0.66 seconds ====================\n\n\n.. _Salt: https://saltstack.com/\n.. _Ansible: https://www.ansible.com/\n.. _Puppet: https://puppetlabs.com/\n.. _Chef: https://www.chef.io/\n.. _Serverspec: https://serverspec.org/\n.. _Pytest: https://pytest.org/\n",
"bugtrack_url": null,
"license": "",
"summary": "Test infrastructures",
"version": "0.8.1",
"project_urls": {
"Homepage": "https://github.com/pytest-dev/pytest-testinfra"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "45bda62219df36c9e6c207ac2512c837720f2096675bb555f2631453485e3a7c",
"md5": "4d4b8a6d7ed8bcf9716c47b81c553f55",
"sha256": "8f9e0411bdd231ad86f9706021fc959135f3eb199a4c5584274106bd0bc20154"
},
"downloads": -1,
"filename": "pytest-testinfra-winrm-transport-0.8.1.tar.gz",
"has_sig": false,
"md5_digest": "4d4b8a6d7ed8bcf9716c47b81c553f55",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 84414,
"upload_time": "2023-09-21T10:57:58",
"upload_time_iso_8601": "2023-09-21T10:57:58.168480Z",
"url": "https://files.pythonhosted.org/packages/45/bd/a62219df36c9e6c207ac2512c837720f2096675bb555f2631453485e3a7c/pytest-testinfra-winrm-transport-0.8.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-21 10:57:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pytest-dev",
"github_project": "pytest-testinfra",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "pytest-testinfra-winrm-transport"
}