{ "info": { "author": "Inmanta NV", "author_email": "code@inmanta.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Plugins", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Software Development", "Topic :: Software Development :: Testing" ], "description": "# pytest-inmanta\n\nA pytest plugin to test inmanta modules\n\n## Installation\n\n```bash\npip install pytest-inmanta\n```\n\n## Usage\n\nThis plugin provides a test fixture that can compile, export and deploy code without running an actual inmanta server.\n\n```python\ndef test_compile(project):\n \"\"\"\n Test compiling a simple model that uses std\n \"\"\"\n project.compile(\"\"\"\nhost = std::Host(name=\"server\", os=std::linux)\nfile = std::ConfigFile(host=host, path=\"/tmp/test\", content=\"1234\")\n \"\"\")\n```\n\nThe fixture also provides access to the model internals\n\n```python\n assert len(project.get_instances(\"std::Host\")) == 1\n assert project.get_instances(\"std::Host\")[0].name == \"server\"\n```\n\nTo the exported resources\n\n```python\n f = project.get_resource(\"std::ConfigFile\")\n assert f.permissions == 644\n```\n\nTo compiler output and mock filesystem\n\n```python\ndef test_template(project):\n \"\"\"\n Test the evaluation of a template\n \"\"\"\n project.add_mock_file(\"templates\", \"test.tmpl\", \"{{ value }}\")\n project.compile(\"\"\"import unittest\nvalue = \"1234\"\nstd::print(std::template(\"unittest/test.tmpl\"))\n \"\"\")\n\n assert project.get_stdout() == \"1234\\n\"\n```\n\nAnd allows deploy\n\n```python\n project.deploy_resource(\"std::ConfigFile\")\n```\n\nAnd dryrun\n\n```python\n changes = project.dryrun_resource(\"testmodule::Resource\")\n assert changes == {\"value\": {'current': 'read', 'desired': 'write'}}\n```\n\n## Testing plugins\n\nTake the following plugin as an example:\n\n```python\n # /plugins/__init__.py\n\n from inmanta.plugins import plugin\n\n @plugin\n def hostname(fqdn: \"string\") -> \"string\":\n \"\"\"\n Return the hostname part of the fqdn\n \"\"\"\n return fqdn.split(\".\")[0]\n```\n\n\nA test case, to test this plugin looks like this:\n\n```python class: {.line-numbers}\n # /tests/test_hostname.py\n\n def test_hostname(project):\n host = \"test\"\n fqdn = f\"{host}.something.com\"\n assert project.get_plugin_function(\"hostname\")(fqdn) == host\n```\n\n\n* **Line 3:** Creates a pytest test case, which requires the `project` fixture.\n* **Line 6:** Calls the function `project.get_plugin_function(plugin_name: str): FunctionType`, which returns the plugin\n function named `plugin_name`. As such, this line tests whether `host` is returned when the plugin function\n `hostname` is called with the parameter `fqdn`.\n\n## Options\n\nThe following options are available.\n\n * --venv: folder in which to place the virtual env for tests (will be shared by all tests), overrides INMANTA_TEST_ENV.\n This options depends on symlink support. This does not work on all windows versions. On windows 10 you need to run pytest in an\n admin shell.\n * --module_repo: location to download modules from, overrides INMANTA_MODULE_REPO. The default value is the inmanta github organisation.\n \n Use the generic pytest options `--log-cli-level` to show Inmanta logger to see any setup or cleanup warnings. For example,\n `--log-cli-level=INFO`", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/inmanta/pytest-inmanta", "keywords": "pytest py.test inmanta testing unit tests plugin", "license": "Apache License, Version 2.0", "maintainer": "", "maintainer_email": "", "name": "pytest-inmanta", "package_url": "https://pypi.org/project/pytest-inmanta/", "platform": "", "project_url": "https://pypi.org/project/pytest-inmanta/", "project_urls": { "Homepage": "https://github.com/inmanta/pytest-inmanta" }, "release_url": "https://pypi.org/project/pytest-inmanta/0.8.0/", "requires_dist": null, "requires_python": "", "summary": "A py.test plugin providing fixtures to simplify inmanta modules testing.", "version": "0.8.0" }, "last_serial": 5872309, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "fbeda7018ef9567bf66720db0b3cc149", "sha256": "8243570d96fe5d42c9ccae4eb7175fcf6e6876465acd17802287408c9ba6315e" }, "downloads": -1, "filename": "pytest_inmanta-0.1-py3.5.egg", "has_sig": false, "md5_digest": "fbeda7018ef9567bf66720db0b3cc149", "packagetype": "bdist_egg", "python_version": "3.5", "requires_python": null, "size": 6827, "upload_time": "2016-09-14T11:13:41", "url": "https://files.pythonhosted.org/packages/dc/cb/f50f99a837c275a2b7b42e75f1ea3b2449b7bc3a6fe740f255c32d71fbbe/pytest_inmanta-0.1-py3.5.egg" }, { "comment_text": "", "digests": { "md5": "964e28f38015338500ff64642002c812", "sha256": "4ff776f368a9898ab3599623fffdfedd149b54ccec4c0e1cc04068498e1ccd37" }, "downloads": -1, "filename": "pytest_inmanta-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "964e28f38015338500ff64642002c812", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4858, "upload_time": "2016-09-14T11:13:39", "url": "https://files.pythonhosted.org/packages/94/75/2dcac70c2b05238be50dc489aef9da4b7c25bcbec9a9e5b66a30a8034003/pytest_inmanta-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a8a47bf19e2a861169ca93124e7a30f0", "sha256": "d53a6607e358669b8fdba2925193e3395b8dc0e1ff91ba0bf0f1b9173c12503a" }, "downloads": -1, "filename": "pytest-inmanta-0.1.tar.gz", "has_sig": false, "md5_digest": "a8a47bf19e2a861169ca93124e7a30f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3147, "upload_time": "2016-09-14T11:13:44", "url": "https://files.pythonhosted.org/packages/91/40/f6c7833f4b57dfa6756ce9341555da454ae3d71fd1b29a66ee29af53bc43/pytest-inmanta-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "be6d0ca9ccd8c71763eacf78d3a99335", "sha256": "21ef8ee6250cbad3d8724229c7fb54a8a5f23fc9c374137c951f6aeb779748f1" }, "downloads": -1, "filename": "pytest_inmanta-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "be6d0ca9ccd8c71763eacf78d3a99335", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4860, "upload_time": "2017-01-20T10:46:37", "url": "https://files.pythonhosted.org/packages/73/9d/a571b96a9675efef24c73cf50bb9819bb8dffddd1318af2d64a6d944c4a2/pytest_inmanta-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a1ecefa148a8187ac5796c785627414f", "sha256": "ac049a45046c88107f72df5f2d4ff79cbc2a1c9e81f44063eeac9c69a8cde054" }, "downloads": -1, "filename": "pytest-inmanta-0.2.tar.gz", "has_sig": false, "md5_digest": "a1ecefa148a8187ac5796c785627414f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3154, "upload_time": "2017-01-20T10:46:39", "url": "https://files.pythonhosted.org/packages/55/23/7f95566caf7f2b051ae4d069d0b0e1b6a9280722e335a5fd187831c6e274/pytest-inmanta-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "1b9f481f3003caca1c04931ccce85af1", "sha256": "fb374f55fb81f5341817dcd82ee10a9b06ed8f59203d7d8c1b9d9942012b596d" }, "downloads": -1, "filename": "pytest_inmanta-0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "1b9f481f3003caca1c04931ccce85af1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5995, "upload_time": "2017-02-23T13:39:43", "url": "https://files.pythonhosted.org/packages/73/72/9e89da98709ca6aa661e3b87c5c5abf935713df3c3028356d77f692aecf7/pytest_inmanta-0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fb46aafd1614d8f2b61d6568440e2b50", "sha256": "4ff8be887a7542b65a9b0321f446752c11beb4393d91a079757aa74217564153" }, "downloads": -1, "filename": "pytest-inmanta-0.3.tar.gz", "has_sig": false, "md5_digest": "fb46aafd1614d8f2b61d6568440e2b50", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4168, "upload_time": "2017-02-23T13:39:35", "url": "https://files.pythonhosted.org/packages/2e/15/6c8d93b3fa6e06d68e4bbf28f8d216709e9eac926e88eacd785205007f16/pytest-inmanta-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "c0b28c553e7f7a583cdd1b8187190332", "sha256": "4f53121ec2c87b3a5b49d02397f460c94ab5022e401d700376b77b5427396b05" }, "downloads": -1, "filename": "pytest_inmanta-0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "c0b28c553e7f7a583cdd1b8187190332", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6294, "upload_time": "2017-03-17T14:03:51", "url": "https://files.pythonhosted.org/packages/ea/93/4ddb71fecebc81c14ece52dac703b27e944819b973214bb7a302a5967d3d/pytest_inmanta-0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d8327c89ce13fb347b9bdc3f85db21bb", "sha256": "29d20e7ebdb911f18d0124d635b34cdaa5468aa6928e54ae09d6476c52e3f14c" }, "downloads": -1, "filename": "pytest-inmanta-0.4.tar.gz", "has_sig": false, "md5_digest": "d8327c89ce13fb347b9bdc3f85db21bb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4455, "upload_time": "2017-03-17T14:03:52", "url": "https://files.pythonhosted.org/packages/77/6d/7d94d22bd4617007366449ff959ff28279a19068dac937cb231acca4488e/pytest-inmanta-0.4.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "153b7158866de0e7a87a2a8577162c47", "sha256": "4acae44e627743689c878884c6079cedca25d1e3b167ed90f5166d4c0dbb7cda" }, "downloads": -1, "filename": "pytest-inmanta-0.4.1.tar.gz", "has_sig": false, "md5_digest": "153b7158866de0e7a87a2a8577162c47", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4445, "upload_time": "2017-06-28T11:45:01", "url": "https://files.pythonhosted.org/packages/cb/ce/1b463dcfb09b3e32aa8713c4a5364a81c362a2c6740c2d3956a3be1b8e8b/pytest-inmanta-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "2244daeeb9b0549302ece5a29315d561", "sha256": "f9a790820603583fa87f61319c7ee8dae1e0cbe71612ce537589c8599b838fd0" }, "downloads": -1, "filename": "pytest-inmanta-0.4.2.tar.gz", "has_sig": false, "md5_digest": "2244daeeb9b0549302ece5a29315d561", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4529, "upload_time": "2017-06-30T10:54:46", "url": "https://files.pythonhosted.org/packages/65/68/a824b37ead4c7b34477121518d09fa804c6c6409bfa9c94b2b55deef4949/pytest-inmanta-0.4.2.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "1f7ba612108ca3eb999bab4b5b9426e6", "sha256": "b8eaebce9c3dd8fb44776fb7f9c4869c08c85675c34245fa78c64c3b6e008727" }, "downloads": -1, "filename": "pytest-inmanta-0.5.0.tar.gz", "has_sig": false, "md5_digest": "1f7ba612108ca3eb999bab4b5b9426e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5922, "upload_time": "2019-02-11T21:08:36", "url": "https://files.pythonhosted.org/packages/12/59/759ec84bba72e203a8010ebc818db8d55801dcc8b10a16af0e4ff1daa956/pytest-inmanta-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "9f041df6b0f40d4c7b7c90e2f6746e51", "sha256": "6403198f269bea9fac0ca2b4bda077ffe64e53d3d75205ca64c416cf6786c1ee" }, "downloads": -1, "filename": "pytest-inmanta-0.6.0.tar.gz", "has_sig": true, "md5_digest": "9f041df6b0f40d4c7b7c90e2f6746e51", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6584, "upload_time": "2019-05-06T08:38:41", "url": "https://files.pythonhosted.org/packages/1b/bd/b6f7302cec355175580a3b0d0f758ac87d5a95596a86ab9040d1a22834b3/pytest-inmanta-0.6.0.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "5b8718d3dfdb6bcde8db39e1c7ffda46", "sha256": "8109bad6782d85fe4653bd015211faad85fca888c7203aaf4924204afbd40d5f" }, "downloads": -1, "filename": "pytest-inmanta-0.7.0.tar.gz", "has_sig": true, "md5_digest": "5b8718d3dfdb6bcde8db39e1c7ffda46", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7708, "upload_time": "2019-09-09T13:07:14", "url": "https://files.pythonhosted.org/packages/cc/36/b205e0488dcde2667ecf59ee52f34796498a42a7e669883870d3ddb6054a/pytest-inmanta-0.7.0.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "e5cae3fe0287445ecd606800067ca4cf", "sha256": "d96773c0db1f497b929ddd7fa5b063d4556e936273d7d0b8540bb90ab3a8d058" }, "downloads": -1, "filename": "pytest-inmanta-0.7.1.tar.gz", "has_sig": true, "md5_digest": "e5cae3fe0287445ecd606800067ca4cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8558, "upload_time": "2019-09-13T09:22:37", "url": "https://files.pythonhosted.org/packages/18/11/cd6f049c73f9158dafffd909431acbb180673732c360641fa32e7d5e374a/pytest-inmanta-0.7.1.tar.gz" } ], "0.7.2": [ { "comment_text": "", "digests": { "md5": "ac7724e4fe46c8ce5880fdfd80ec0687", "sha256": "3505408365996feeab80b4e44dacf967aee09c172478af0a37ffdfaef5a622ee" }, "downloads": -1, "filename": "pytest-inmanta-0.7.2.tar.gz", "has_sig": true, "md5_digest": "ac7724e4fe46c8ce5880fdfd80ec0687", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8577, "upload_time": "2019-09-17T12:57:59", "url": "https://files.pythonhosted.org/packages/ce/54/59d10d1aed7b70adb5792b8e0951950d2c648cc4fb9cd26eb69edecbdc63/pytest-inmanta-0.7.2.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "d89d6f8d40f259adba6737b89b151192", "sha256": "e70d200c06a89d4b38b2675f90cadf9cdca21a092566016efa6dc08e7ea3173a" }, "downloads": -1, "filename": "pytest-inmanta-0.8.0.tar.gz", "has_sig": true, "md5_digest": "d89d6f8d40f259adba6737b89b151192", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8653, "upload_time": "2019-09-23T08:57:29", "url": "https://files.pythonhosted.org/packages/48/b0/21fea77bcf588e15c2dd430114cedda0e6302735daac1a30ae8b0a3ae89d/pytest-inmanta-0.8.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d89d6f8d40f259adba6737b89b151192", "sha256": "e70d200c06a89d4b38b2675f90cadf9cdca21a092566016efa6dc08e7ea3173a" }, "downloads": -1, "filename": "pytest-inmanta-0.8.0.tar.gz", "has_sig": true, "md5_digest": "d89d6f8d40f259adba6737b89b151192", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8653, "upload_time": "2019-09-23T08:57:29", "url": "https://files.pythonhosted.org/packages/48/b0/21fea77bcf588e15c2dd430114cedda0e6302735daac1a30ae8b0a3ae89d/pytest-inmanta-0.8.0.tar.gz" } ] }