{ "info": { "author": "Wojciech Olejarz, Bartlomiej Skrobek", "author_email": "olejarz.wojciech@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Pytest", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Testing" ], "description": "=================\npytest-testconfig\n=================\n\n.. image:: https://img.shields.io/pypi/v/pytest-testconfig.svg\n :target: https://pypi.org/project/pytest-testconfig\n :alt: PyPI version\n\n.. image:: https://img.shields.io/pypi/pyversions/pytest-testconfig.svg\n :target: https://pypi.org/project/pytest-testconfig\n :alt: Python versions\n\n.. image:: https://travis-ci.org/wojole/pytest-testconfig.svg?branch=master\n :target: https://travis-ci.org/wojole/pytest-testconfig\n :alt: See Build Status on Travis CI\n\n\nTest configuration plugin for pytest.\n\nBased on nose-testconfig by Jesse Noller. Rewritten for pytest by Wojciech Olejarz and Bart\u0142omiej Skrobek.\n\n----\n\nThis `pytest`_ plugin was generated with `Cookiecutter`_ along with `@hackebrot`_'s `cookiecutter-pytest-plugin`_ template.\n\n\nFeatures\n--------\npytest-testconfig is a plugin to the pytest test framework used for passing test-specific (or test-run specific) configuration data\nto the tests being executed.\n\nCurrently configuration files in the following formats should be supported:\n\n- YAML (via `PyYAML `_)\n- INI (via `ConfigParser `_)\n- Pure Python (via Exec)\n- JSON (via `JSON `_)\n\nThe plugin is ``meant`` to be flexible, ergo the support of exec'ing arbitrary\npython files as configuration files with no checks. The default format is\nassumed to be ConfigParser ini-style format.\n\nIf multiple files are provided, the objects are merged. Later settings will\noverride earlier ones.\n\nThe plugin provides a method of overriding certain parameters from the command\nline (assuming that the main \"config\" object is a dict) and can easily have\nadditional parsers added to it.\n\nA configuration file may not be provided. In this case, the config object is an\nemtpy dict. Any command line \"overriding\" paramters will be added to the dict.\n\n\nRequirements\n------------\n\nrequires pytest>=3.5.0\n\n\nInstallation\n------------\n\nYou can install \"pytest-testconfig\" via `pip`_ from `PyPI`_::\n\n $ python3 -m pip install pytest-testconfig\n\n\nUsage\n-----\n\nTests can import the \"config\" singleton from testconfig::\n\n from pytest_testconfig import config\n\nBy default, YAML files parse into a nested dictionary, and ConfigParser ini\nfiles are also collapsed into a nested dictionary for foo[bar][baz] style\naccess. Tests can obviously access configuration data by referencing the\nrelevant dictionary keys::\n\n from pytest_testconfig import config\n def test_foo():\n target_server_ip = config['servers']['webapp_ip']\n\n``Warning``: Given this is just a dictionary singleton, tests can easily write\ninto the configuration. This means that your tests can write into the config\nspace and possibly alter it. This also means that threaded access into the\nconfiguration can be interesting.\n\nWhen using pure python configuration - obviously the \"sky is the the limit\" -\ngiven that the configuration is loaded via an exec, you could potentially\nmodify pytest, the plugin, etc. However, if you do not export a config{} dict\nas part of your python code, you obviously won't be able to import the\nconfig object from testconfig.\n\nWhen using YAML-style configuration, you get a lot of the power of pure python\nwithout the danger of unprotected exec() - you can obviously use the pyaml\npython-specific objects and all of the other YAML creamy goodness.\n\nDefining a configuration file\n-----------------------------\n\nSimple ConfigParser style::\n\n [myapp_servers]\n main_server = 10.1.1.1\n secondary_server = 10.1.1.2\n\nSo your tests access the config options like this::\n\n from pytest_testconfig import config\n def test_foo():\n main_server = config['myapp_servers']['main_server']\n\nYAML style configuration::\n myapp:\n servers:\n main_server: 10.1.1.1\n secondary_server: 10.1.1.2\n\nAnd your tests can access it thus::\n\n from pytest_testconfig import config\n def test_foo():\n main_server = config['myapp']['servers']['main_server']\n\nPython configuration file::\n\n import socket\n\n global config\n config = {}\n possible_main_servers = ['10.1.1.1', '10.1.1.2']\n\n for srv in possible_main_servers:\n try:\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n s.connect((srv, 80))\n except:\n continue\n s.close()\n config['main_server'] = srv\n break\n\nAnd lo, the config is thus::\n\n from pytest_testconfig import config\n def test_foo():\n main_server = config['main_server']\n\nIf you need to put python code into your configuration, you either need to use\nthe python-config file faculties, or you need to use the !!python tags within\nPyYAML/YAML - raw ini files no longer have any sort of eval magic.\n\nCommand line options\n--------------------\n\nAfter it is installed, the plugin adds the following command line flags to\npytest::\n\n --tc-file=TESTCONFIG Configuration file to parse and pass to tests\n [PY_TEST_CONFIG_FILE]\n If this is specified multiple times, all files\n will be parsed. In all formats except python,\n previous contents are preserved and the configs\n are merged.\n\n --tc-format=TESTCONFIGFORMAT Test config file format, default is\n configparser ini format\n [PY_TEST_CONFIG_FILE_FORMAT]\n\n --tc=OVERRIDES Option:Value specific overrides.\n\n --tc-exact Optional: Do not explode periods in override keys to\n individual keys within the config dict, instead treat\n them as config[my.toplevel.key] ala sqlalchemy.url in\n pylons.\n\nContributing\n------------\nContributions are very welcome. Tests can be run with `tox`_, please ensure\nthe coverage at least stays the same before you submit a pull request.\n\nLicense\n-------\n\nDistributed under the terms of the `Apache Software License 2.0`_ license, \"pytest-testconfig\" is free and open source software\n\n\nIssues\n------\n\nIf you encounter any problems, please `file an issue`_ along with a detailed description.\n\n.. _`Cookiecutter`: https://github.com/audreyr/cookiecutter\n.. _`@hackebrot`: https://github.com/hackebrot\n.. _`MIT`: http://opensource.org/licenses/MIT\n.. _`BSD-3`: http://opensource.org/licenses/BSD-3-Clause\n.. _`GNU GPL v3.0`: http://www.gnu.org/licenses/gpl-3.0.txt\n.. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0\n.. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin\n.. _`file an issue`: https://github.com/wojole/pytest-testconfig/issues\n.. _`pytest`: https://github.com/pytest-dev/pytest\n.. _`tox`: https://tox.readthedocs.io/en/latest/\n.. _`pip`: https://pypi.org/project/pip/\n.. _`PyPI`: https://pypi.org/project\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wojole/pytest-testconfig", "keywords": "", "license": "Apache Software License 2.0", "maintainer": "Wojciech Olejarz, Bartlomiej Skrobek", "maintainer_email": "olejarz.wojciech@gmail.com", "name": "pytest-testconfig", "package_url": "https://pypi.org/project/pytest-testconfig/", "platform": "", "project_url": "https://pypi.org/project/pytest-testconfig/", "project_urls": { "Homepage": "https://github.com/wojole/pytest-testconfig" }, "release_url": "https://pypi.org/project/pytest-testconfig/0.1.2/", "requires_dist": [ "pytest (>=3.5.0)", "pyyaml" ], "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "summary": "Test configuration plugin for pytest.", "version": "0.1.2" }, "last_serial": 5452177, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a61070973dfae0a2c6fa3aaab3554f07", "sha256": "7e2390643c9c5a99389c9e95652e2435d172f1ca5af09347134af4a15cf21b6f" }, "downloads": -1, "filename": "pytest_testconfig-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a61070973dfae0a2c6fa3aaab3554f07", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 6825, "upload_time": "2018-07-23T12:49:08", "url": "https://files.pythonhosted.org/packages/fd/3b/8d80f3ed6fa2d92eec546665d48de431820df81bbb77bc71a93143c4da9d/pytest_testconfig-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5bba80ed931df655a32bee624fe3d24a", "sha256": "5f627a7473003c136225fe82120770a865cb680f824a9adbad5b2a413edaac1c" }, "downloads": -1, "filename": "pytest-testconfig-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5bba80ed931df655a32bee624fe3d24a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 10540, "upload_time": "2018-07-23T12:49:10", "url": "https://files.pythonhosted.org/packages/88/19/6e99913e9ec2834f022c15d20fe76dea1acffcbd7f9c4f2ebcf975f9a1c9/pytest-testconfig-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "96b12f673dd900cb8bae97339541ea32", "sha256": "2e9c2ae6036180841170aea34af9f3b45f321e087b8dd4f4b6f5c4de65e35039" }, "downloads": -1, "filename": "pytest_testconfig-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "96b12f673dd900cb8bae97339541ea32", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 10804, "upload_time": "2018-11-26T23:06:37", "url": "https://files.pythonhosted.org/packages/d3/eb/72ee2694757df2ea834198fac4f183973f0908b8ffdd05615efabc0007dc/pytest_testconfig-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "25d501617a97f20390e7c3340b2aff66", "sha256": "687d068869e74190e90cc394f116a314b40e4ee8a152bac755ac58adddf3962d" }, "downloads": -1, "filename": "pytest-testconfig-0.1.1.tar.gz", "has_sig": false, "md5_digest": "25d501617a97f20390e7c3340b2aff66", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 12826, "upload_time": "2018-11-26T23:06:38", "url": "https://files.pythonhosted.org/packages/95/c2/5fab55e10c7e2df34b0b88636070b558a7daf0ddaf78020897636d2e3b70/pytest-testconfig-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "67439c1a510079dd1c76940bc3ede875", "sha256": "0c1967082aa0ef3d553d38e7fbf6bbe85b77aabe78d022500462bc3d7f8ac198" }, "downloads": -1, "filename": "pytest_testconfig-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "67439c1a510079dd1c76940bc3ede875", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 10830, "upload_time": "2019-06-21T11:04:43", "url": "https://files.pythonhosted.org/packages/b4/5d/86ec75f9bfe4f8e67e29cd36404e2841729fee85cc510e99c10733b14afa/pytest_testconfig-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "55a56c619663700786f52ce9b4f49481", "sha256": "53b9bce23386f884c6aff164ecc2653c4c4883460a2316608c141cbc40aab974" }, "downloads": -1, "filename": "pytest-testconfig-0.1.2.tar.gz", "has_sig": false, "md5_digest": "55a56c619663700786f52ce9b4f49481", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 11415, "upload_time": "2019-06-21T11:04:44", "url": "https://files.pythonhosted.org/packages/d3/60/49329853bcb1820ae374336c72a2de434bc481026c22fe5f5b8f57e28d02/pytest-testconfig-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "67439c1a510079dd1c76940bc3ede875", "sha256": "0c1967082aa0ef3d553d38e7fbf6bbe85b77aabe78d022500462bc3d7f8ac198" }, "downloads": -1, "filename": "pytest_testconfig-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "67439c1a510079dd1c76940bc3ede875", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 10830, "upload_time": "2019-06-21T11:04:43", "url": "https://files.pythonhosted.org/packages/b4/5d/86ec75f9bfe4f8e67e29cd36404e2841729fee85cc510e99c10733b14afa/pytest_testconfig-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "55a56c619663700786f52ce9b4f49481", "sha256": "53b9bce23386f884c6aff164ecc2653c4c4883460a2316608c141cbc40aab974" }, "downloads": -1, "filename": "pytest-testconfig-0.1.2.tar.gz", "has_sig": false, "md5_digest": "55a56c619663700786f52ce9b4f49481", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 11415, "upload_time": "2019-06-21T11:04:44", "url": "https://files.pythonhosted.org/packages/d3/60/49329853bcb1820ae374336c72a2de434bc481026c22fe5f5b8f57e28d02/pytest-testconfig-0.1.2.tar.gz" } ] }