{ "info": { "author": "Joep Schuurkes", "author_email": "j19sch@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Pytest", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Testing" ], "description": "=================\npytest-instrument\n=================\n\n.. image:: https://img.shields.io/pypi/v/pytest-instrument.svg\n :target: https://pypi.org/project/pytest-instrument\n :alt: PyPI version\n\n.. image:: https://img.shields.io/pypi/pyversions/pytest-instrument.svg\n :target: https://pypi.org/project/pytest-instrument\n :alt: Python versions\n\n.. image:: https://img.shields.io/pypi/dm/pytest-instrument\n :target: https://pypistats.org/packages/pytest-instrument\n :alt: PyPI - Downloads\n\n.. image:: https://circleci.com/gh/j19sch/pytest-instrument/tree/master.svg?style=svg\n :target: https://circleci.com/gh/j19sch/pytest-instrument/tree/master\n :alt: See Build Status on Circle CI\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n\n.. image:: https://img.shields.io/github/license/mashape/apistatus.svg\n :target: https://github.com/j19sch/pytest-logfest/blob/master/LICENSE\n :alt: MIT license\n\nA `pytest`_ plugin to instrument tests and write the resulting records to file\n\n----\n\n\nFeatures\n--------\n\n* a log file with one record for each setup/call/teardown of each test containing:\n\n * session id and record id (UUIDs generated by plugin)\n * node_id (pytest's `nodeid`)\n * when (setup, call or teardown)\n * outcome (passed, failed or skipped)\n * start, stop and duration\n * labels (`array`) and tags (`object`) via :code:`@pytest.mark.instrument()` decorator\n * fixtures\n* hooks to edit labels, tags and fixtures before the record is written to file\n* a logger to emit records with session id, record id, node id to the same log file\n\n\nRequirements\n------------\n\n* Python 3.6 or higher\n* pytest 5.1.0 or higher\n\n\nInstallation\n------------\n\nYou can install \"pytest-instrument\" via `pip`_ from `PyPI`_::\n\n $ pip install pytest-instrument\n\n\nUsage\n-----\n\nRun your tests with::\n\n $ pytest --instrument=json\n\nAn `./artifacts` directory will be created if it doesn't exist yet. For each `pytest` session one `.json` file\nwill be written to that directory. The format of the filename is :code:`%Y%m%dT%H%M%S_.json`.\n\nTo display the contents of the `.log` file, use `jq`: :code:`jq . `. Or, if for instance you only want to\nsee the message object of each record: :code:`jq '{message: .message}' `\n\nOutput to regular log file\n~~~~~~~~~~~~~~~~~~~~~~~~~~\nIf you want to output a regular log file, use `--instrument=log` (or `--instrument=json,log` if you want both).\nNote that the regular log file only contains the time, log node name, log level, test node id and log message\nof each log record.\n\n\nLoggers - instr.log and instr.report\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nThe logger reporting on the outcome of pytest's setup, call and teardown is named \"instr.report\".\n\nThe logger emitting records to the same file as the \"instr.report\" logger is named \"instr.log\".\nYou can use this logger like this:\n\n.. code-block:: python\n\n logger = logging.getLogger(\"instr.log\")\n logger.info(\"log record of level info\")\n\nYou can also create children of that logger, which will emit records to that same file:\n\n.. code-block:: python\n\n sublogger = logging.getLogger(\"instr.log\").getChild(\"sublogger\")\n logger.warning(\"log record of level warning\")\n\nThe session id and node id of the \"instr.log\" logger and its children are set automatically in the :code:`getChild()` method.\nThe node id is updated automatically via pytests's :code:`pytest_runtest_setup()` hook.\n\n\nLabels and tags\n~~~~~~~~~~~~~~~\nYou can add labels and tags to tests with the plugin's `mark` decorator::\n\n@pytest.mark.instrument(\"a_label\", my_tag=\"tagged\")\n\nAll `args`, such as :code:`\"a_label\"`, are put in the json array `labels`.\nAll `kwargs`, such as :code:`my_tag=\"tagged\"`, are put in the json object `tags`.\n\n\nHooks\n~~~~~\n- :code:`pytest_instrument_labels`: edit list of labels after they've been parsed by the plugin\n- :code:`pytest_instrument_tags`: edit dictionary of tags after they've been parsed by the plugin\n- :code:`pytest_instrument_fixtures`: edit list of fixtures after they've been parsed by the plugin\n\n\nChangelog\n---------\n\nConsult the `changelog `_ for fixes and enhancements of each version.\n\n\nIssues/Requests\n---------------\n\nPlease use the `GitHub issue tracker `_ to submit bugs or request features.\n\n\nContributing\n------------\nContributions are welcome. Tests can be run with `tox`_, please ensure\n`black`_ code formatting and good test coverage before you submit a pull request.\n\n\nLicense\n-------\n\nDistributed under the terms of the `MIT`_ license, \"pytest-instrument\" is free and open source software\n\n\nAcknowledgements\n----------------\nThank you to `Maaret Pyh\u00e4j\u00e4rvi `_ for inspiring this plugin by sharing the story of how her team\nstarted instrumenting tests at `TestCraftCamp`_ 2019.\n\nThank you to `Tony S Yu `_ for backporting the :code:`stacklevel` argument from Python 3.8 logging.\n\nThis `pytest`_ plugin was generated with `Cookiecutter`_ along with `@hackebrot`_'s `cookiecutter-pytest-plugin`_ template.\n\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.. _`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.. _`black`: https://github.com/psf/black\n.. _`TestCraftCamp`: https://testcraftcamp.nl/\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/j19sch/pytest-instrument", "keywords": "", "license": "MIT", "maintainer": "Joep Schuurkes", "maintainer_email": "j19sch@gmail.com", "name": "pytest-instrument", "package_url": "https://pypi.org/project/pytest-instrument/", "platform": "", "project_url": "https://pypi.org/project/pytest-instrument/", "project_urls": { "Homepage": "https://github.com/j19sch/pytest-instrument" }, "release_url": "https://pypi.org/project/pytest-instrument/0.3.1/", "requires_dist": [ "pytest (>=5.1.0)", "python-json-logger (>=0.1.11)" ], "requires_python": ">=3.6", "summary": "pytest plugin to instrument tests", "version": "0.3.1", "yanked": false, "yanked_reason": null }, "last_serial": 6954959, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "ffba2af54aa9d825c0950af5a1f99565", "sha256": "2b2e2b6937b21f1037375fec687c5db107ea83e7af6b9a7121081989b3be24be" }, "downloads": -1, "filename": "pytest_instrument-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ffba2af54aa9d825c0950af5a1f99565", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 7508, "upload_time": "2019-10-21T13:06:54", "upload_time_iso_8601": "2019-10-21T13:06:54.955490Z", "url": "https://files.pythonhosted.org/packages/49/0c/fb674235e94843fc1647cda85e04a44a8ac524c5c75570176ade98fa0150/pytest_instrument-0.1.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "fd9363f9085f602d20660b04a16ec6a2", "sha256": "b5e9e5e1798df1918eee53b3c84fb32a07df1dfd772ebe51db7a025c450b10b4" }, "downloads": -1, "filename": "pytest-instrument-0.1.0.tar.gz", "has_sig": false, "md5_digest": "fd9363f9085f602d20660b04a16ec6a2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 5266, "upload_time": "2019-10-21T13:07:00", "upload_time_iso_8601": "2019-10-21T13:07:00.131913Z", "url": "https://files.pythonhosted.org/packages/89/79/a0cec4f35058397b980b396ffdaebd585bbb6aa67065de38b6093d37cfde/pytest-instrument-0.1.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "847ddea611c0d953c3040cbf6d20ec85", "sha256": "a321d5f9eb48a8e7a8a153e5120017d447748cd21d1e0cf49c244df7c6ea4e72" }, "downloads": -1, "filename": "pytest_instrument-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "847ddea611c0d953c3040cbf6d20ec85", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 12033, "upload_time": "2019-12-15T09:58:06", "upload_time_iso_8601": "2019-12-15T09:58:06.402250Z", "url": "https://files.pythonhosted.org/packages/a7/3d/a2686a5938aed22041d5c7a9f5f9f3a5d7d0d752fe5335cc70664b3c8f4d/pytest_instrument-0.2.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "5949c80f110639ff6735aea9cf71e2bf", "sha256": "72ff1f465cf0431f396cda73732c5f0dde9eecfc7490c731af4298a010d1505a" }, "downloads": -1, "filename": "pytest-instrument-0.2.0.tar.gz", "has_sig": false, "md5_digest": "5949c80f110639ff6735aea9cf71e2bf", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 8569, "upload_time": "2019-12-15T09:58:08", "upload_time_iso_8601": "2019-12-15T09:58:08.130864Z", "url": "https://files.pythonhosted.org/packages/8b/ec/4adf6a53c217630a244bbf004c5a26e2be6f5dd281269d1524a37119213b/pytest-instrument-0.2.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "6c355b751ac09a0843eb2faa07c5850b", "sha256": "4440695168118d1c67430e901473b7fb8d9ec32b3c24f00d23d2cf06920360e8" }, "downloads": -1, "filename": "pytest_instrument-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6c355b751ac09a0843eb2faa07c5850b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 12430, "upload_time": "2020-02-23T14:00:07", "upload_time_iso_8601": "2020-02-23T14:00:07.194689Z", "url": "https://files.pythonhosted.org/packages/6d/f0/57cf75f386af62110a71169877a68c1ef40663074222610165db09ff4dbf/pytest_instrument-0.3.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "7fc977db166e992bb66256ade506caff", "sha256": "ca9d0e3be177b5629c41cc9443ea905b561def3c88bde4f95d92e87e77d91602" }, "downloads": -1, "filename": "pytest-instrument-0.3.0.tar.gz", "has_sig": false, "md5_digest": "7fc977db166e992bb66256ade506caff", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 8995, "upload_time": "2020-02-23T14:00:08", "upload_time_iso_8601": "2020-02-23T14:00:08.779466Z", "url": "https://files.pythonhosted.org/packages/09/71/53c54cb4915f6c6906ffb148481cddf62f7d90c77d56009053cc1ad2443c/pytest-instrument-0.3.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "09f200dce4bba4ca95a25ca67052dc98", "sha256": "03c479cb30ece637a149f9f81601e6f8a1de453044596e9d847dcb85c7e912f4" }, "downloads": -1, "filename": "pytest_instrument-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "09f200dce4bba4ca95a25ca67052dc98", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 10170, "upload_time": "2020-04-05T10:30:50", "upload_time_iso_8601": "2020-04-05T10:30:50.097249Z", "url": "https://files.pythonhosted.org/packages/25/ef/cc659a031ec6806d2db39f051b2393baeb2e0dfd3eb9f90708b66b5c9f92/pytest_instrument-0.3.1-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "494ef3cb82d5c18c5de14d286a51ee1f", "sha256": "d155aea3642528819808f419b08e654975ce9ef657781fc760521950b367249d" }, "downloads": -1, "filename": "pytest-instrument-0.3.1.tar.gz", "has_sig": false, "md5_digest": "494ef3cb82d5c18c5de14d286a51ee1f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 7122, "upload_time": "2020-04-05T10:30:51", "upload_time_iso_8601": "2020-04-05T10:30:51.424524Z", "url": "https://files.pythonhosted.org/packages/c8/06/f54516f394ff6dd3d18e8e29935c702d564408a90b387dc5e02c5c0e435c/pytest-instrument-0.3.1.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "09f200dce4bba4ca95a25ca67052dc98", "sha256": "03c479cb30ece637a149f9f81601e6f8a1de453044596e9d847dcb85c7e912f4" }, "downloads": -1, "filename": "pytest_instrument-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "09f200dce4bba4ca95a25ca67052dc98", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 10170, "upload_time": "2020-04-05T10:30:50", "upload_time_iso_8601": "2020-04-05T10:30:50.097249Z", "url": "https://files.pythonhosted.org/packages/25/ef/cc659a031ec6806d2db39f051b2393baeb2e0dfd3eb9f90708b66b5c9f92/pytest_instrument-0.3.1-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "494ef3cb82d5c18c5de14d286a51ee1f", "sha256": "d155aea3642528819808f419b08e654975ce9ef657781fc760521950b367249d" }, "downloads": -1, "filename": "pytest-instrument-0.3.1.tar.gz", "has_sig": false, "md5_digest": "494ef3cb82d5c18c5de14d286a51ee1f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 7122, "upload_time": "2020-04-05T10:30:51", "upload_time_iso_8601": "2020-04-05T10:30:51.424524Z", "url": "https://files.pythonhosted.org/packages/c8/06/f54516f394ff6dd3d18e8e29935c702d564408a90b387dc5e02c5c0e435c/pytest-instrument-0.3.1.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }