{ "info": { "author": "Vadim Delendik", "author_email": "vdelendik@qaprosoft.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Pytest", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "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 :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Testing" ], "description": "=============\npytest-zafira\n=============\n\n.. image:: https://img.shields.io/pypi/v/pytest-zafira.svg\n :target: https://pypi.org/project/pytest-zafira\n :alt: PyPI version\n\n.. image:: https://img.shields.io/pypi/pyversions/pytest-zafira.svg\n :target: https://pypi.org/project/pytest-zafira\n :alt: Python versions\n\nZafira plugin for pytest\n__________________________\n\nPytest plugin for integration with `Zafira`_.\n\n----\n\n\nInstallation\n------------\n\nInstall using command::\n\n $ pip install pytest-zafira\n\nEnable the fixture explicitly in your tests or conftest.py::\n\n pytest_plugins = ['pytest_zafira.zafira_plugin', 'pytest_zafira.screenshot_plugin']\n\n\nConfiguration\n-------------\n\npytest-zafira plugin searches configuration file in the current working directory and it called 'zafira_properties.ini'. File has to look like::\n\n [config]\n service-url = url for zafira-server + '/zafira-ws'\n zafira_enabled = True (turn on/off fixture)\n zafira_app_url = url of deployed zafira\n access_token = access_token from Zafira dashboard\n job_name = any string you like\n suite_name = any string you like\n artifact_expires_in_default_time = (int value in sec.) an expiration time for amazon bucket link\n artifact_log_name = test_logs\n aws_access_key = secret\n aws_secret_key = secret\n aws_screen_shot_bucket = secret\n s3_save_screenshots = True (save screenshots to AWS S3 bucket)\n\nMore about access_token find here `Integration of Zafira`_.\n\nAfter that step you have to configure logging. An example of logging configuration file (yaml)::\n\n version: 1\n formatters:\n default_formatter:\n format: '%(asctime)s:%(levelname)s - %(message)s'\n datefmt: '%H:%M:%S'\n handlers:\n console:\n class: logging.StreamHandler\n level: 0\n formatter: default_formatter\n stream: ext://sys.stdout\n zafira_log_appender:\n class: pytest_zafira.RabbitHandler\n loggers:\n zafira:\n level: INFO\n handlers: [console, zafira_log_appender]\n propagate: no\n root:\n level: WARN\n handlers: [console, zafira_log_appender]\n\nThen add META_INFO logging level for logger::\n\n import logging.config\n import os\n\n import yaml\n\n\n class LoggingConfiguration:\n def __init__(self):\n self.ROOT_LOG_LEVEL = self.fetch_env(expected_env='ROOT_LOG_LEVEL', default='')\n\n self.ZAFIRA_LOG_LEVEL = self.fetch_env(expected_env='ZAFIRA_LOG_LEVEL', default='')\n\n # and this level is responsible for screenshots\n self.add_meta_info_level()\n # apply configuration from logging.cfg\n self.apply_configuration()\n # set log level according to env variables, do nothing if they empty or overwrite default from logging.cfg\n self.init_loggers()\n\n def init_loggers(self):\n zafira_logger = logging.getLogger('zafira')\n if self.ZAFIRA_LOG_LEVEL:\n zafira_logger.setLevel(self.ZAFIRA_LOG_LEVEL)\n\n @staticmethod\n def add_meta_info_level():\n \"\"\"\n Logging level for screenshots\n \"\"\"\n meta_info_level = logging.DEBUG + 1\n add_logging_level('META_INFO', meta_info_level)\n\n def apply_configuration(self):\n config = yaml.load(open('path/to/your/logging/config/file.yml', 'r'))\n if self.ROOT_LOG_LEVEL:\n config['root']['level'] = os.environ['ROOT_LOG_LEVEL']\n logging.config.dictConfig(config)\n\n @staticmethod\n def fetch_env(expected_env, default):\n if expected_env in os.environ:\n return os.environ[expected_env]\n else:\n return default\n\n\n def add_logging_level(level_name, level_number):\n \"\"\"\n Comprehensively adds a new logging level to the `logging` module and the\n currently configured logging class.\n\n `levelName` becomes an attribute of the `logging` module with the value\n `levelNum`. `methodName` becomes a convenience method for both `logging`\n itself and the class returned by `logging.getLoggerClass()` (usually just\n `logging.Logger`). If `methodName` is not specified, `levelName.lower()` is\n used.\n\n To avoid accidental clobberings of existing attributes, this method will\n raise an `AttributeError` if the level name is already an attribute of the\n `logging` module or if the method name is already present\n \"\"\"\n method_name = level_name.lower()\n\n if hasattr(logging, level_name):\n raise AttributeError('{} already defined in logging module'.format(level_name))\n if hasattr(logging, method_name):\n raise AttributeError('{} already defined in logging module'.format(method_name))\n if hasattr(logging.getLoggerClass(), method_name):\n raise AttributeError('{} already defined in logger class'.format(method_name))\n\n def log_for_level(self, message, *args, **kwargs):\n if self.isEnabledFor(level_number):\n self._log(level_number, message, args, **kwargs)\n\n def log_to_root(message, *args, **kwargs):\n logging.log(level_number, message, *args, **kwargs)\n\n logging.addLevelName(level_number, level_name)\n setattr(logging, level_name, level_number)\n setattr(logging.getLoggerClass(), method_name, log_for_level)\n setattr(logging, method_name, log_to_root)\n\nand activate this config when tests will start.\n\nUsage\n-----\n\nTo use just run the pytest`s tests.\n\nLicense\n-------\n\nDistributed under the terms of the `Apache Software License 2.0`_ license, \"pytest-zafira\" 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.. _`Zafira`: https://github.com/qaprosoft/zafira\n.. _`Integration of Zafira`: https://github.com/qaprosoft/zafira#integration\n.. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0\n.. _`file an issue`: https://github.com/qaprosoft/pytest-zafira/issues\n.. _`Pytest`: https://docs.pytest.org/en/latest/writing_plugins.html#requiring-loading-plugins-in-a-test-module-or-conftest-file\n.. _`pip`: https://pypi.org/project/pip/\n.. _`PyPI`: https://pypi.org/proj\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/qaprosoft/zafira-pytest", "keywords": "pytest,zafira", "license": "Apache Software License 2.0", "maintainer": "Vadim Delendik", "maintainer_email": "vdelendik@qaprosoft.com", "name": "pytest-zafira", "package_url": "https://pypi.org/project/pytest-zafira/", "platform": "", "project_url": "https://pypi.org/project/pytest-zafira/", "project_urls": { "Homepage": "https://github.com/qaprosoft/zafira-pytest" }, "release_url": "https://pypi.org/project/pytest-zafira/1.0.3/", "requires_dist": [ "allure-python-commons (==2.5.4)", "atomicwrites (==1.2.1)", "attrs (==18.2.0)", "boto3 (==1.9.106)", "botocore (==1.12.106)", "certifi (==2018.11.29)", "chardet (==3.0.4)", "configparser (==3.5.0)", "docutils (==0.14)", "idna (==2.8)", "jmespath (==0.9.4)", "more-itertools (==4.3.0)", "pika (==1.0.1)", "pluggy (==0.7.1)", "py (==1.6.0)", "pytest (==4.1.1)", "python-dateutil (==2.8.0)", "PyYAML (==3.13)", "requests (==2.21.0)", "s3transfer (==0.2.0)", "selenium (==3.14.0)", "six (==1.11.0)", "urllib3 (==1.23)" ], "requires_python": "!=2.*.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "summary": "A Zafira plugin for pytest", "version": "1.0.3" }, "last_serial": 5851350, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "6c8986e9ea01e6971369d093d2aa3565", "sha256": "4c347688add1e76719e3d06152af8fd329f5f73529f1d29d0009a1baf0925fc0" }, "downloads": -1, "filename": "pytest_zafira-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6c8986e9ea01e6971369d093d2aa3565", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 24560, "upload_time": "2019-04-04T14:59:34", "url": "https://files.pythonhosted.org/packages/45/25/942362bc9e86fbc461aa0c4a86dd678e516f45acd39fe75af25ff72182f7/pytest_zafira-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9b6d42bbe7a76d6f90b300e7c7233246", "sha256": "6b318efa71df4ad64d992fb978485a6cff8d50211b0b51fb74fb5f7b73a6c03d" }, "downloads": -1, "filename": "pytest-zafira-1.0.0.tar.gz", "has_sig": false, "md5_digest": "9b6d42bbe7a76d6f90b300e7c7233246", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 18868, "upload_time": "2019-04-04T14:59:37", "url": "https://files.pythonhosted.org/packages/a5/58/51716f36d8ef879ff0e915286d92dceeba1da709a220b913ea4775943c02/pytest-zafira-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "e49c2c1ef47ab09f5a42037a1cd6c8a5", "sha256": "4cfd036b2f7ceccc0af060cd42426f404ed7fc948d94019381a1c2eea8eac588" }, "downloads": -1, "filename": "pytest_zafira-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e49c2c1ef47ab09f5a42037a1cd6c8a5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 24516, "upload_time": "2019-04-05T07:33:40", "url": "https://files.pythonhosted.org/packages/38/b1/5dd8031e3dec6eaefa17b56e674064f562638864dcb0ca9ff9e143e19e36/pytest_zafira-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e061c309684f5d0afb5bcd0a83566e27", "sha256": "170e25c1b099a5ffc417386f0c4c0e92a2129a21e4caaea5a48cc2a833f22dde" }, "downloads": -1, "filename": "pytest-zafira-1.0.1.tar.gz", "has_sig": false, "md5_digest": "e061c309684f5d0afb5bcd0a83566e27", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 18816, "upload_time": "2019-04-05T07:33:42", "url": "https://files.pythonhosted.org/packages/38/2d/0de2b8a031c360785a6d0d67d67fe7524a544831f4eb1e18053bb535a964/pytest-zafira-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "3b3f8de880e0311b6d77537d0b0c1088", "sha256": "b8f5f1e9961b461ca379006c0d8d0f88d804af8f432b5f097690c70c89ef6533" }, "downloads": -1, "filename": "pytest_zafira-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "3b3f8de880e0311b6d77537d0b0c1088", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "!=2.*.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 26222, "upload_time": "2019-07-26T11:00:24", "url": "https://files.pythonhosted.org/packages/cc/73/f21c345a1c3f1fc3a9e59bd2f57312df5f18e74b43bf5b2df5b9ef67539d/pytest_zafira-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "68b46d279a39d035318ccd9824ef87f9", "sha256": "68caa7511c056caacf0d6d1781fb592bb8c47ab8fd4a735e58e1721ba7966f0f" }, "downloads": -1, "filename": "pytest-zafira-1.0.2.tar.gz", "has_sig": false, "md5_digest": "68b46d279a39d035318ccd9824ef87f9", "packagetype": "sdist", "python_version": "source", "requires_python": "!=2.*.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 21955, "upload_time": "2019-07-26T11:00:26", "url": "https://files.pythonhosted.org/packages/93/2b/e472cd54b0532138d72364049097e0cf0e798b6b897826298a636935deeb/pytest-zafira-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "18cf458e6a18df236231984af9178d52", "sha256": "e478ed2957778a30be1e8ba6d5fe009afdef2eb93c938567f0a5438655b4cbfe" }, "downloads": -1, "filename": "pytest_zafira-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "18cf458e6a18df236231984af9178d52", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "!=2.*.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 26217, "upload_time": "2019-09-18T16:41:23", "url": "https://files.pythonhosted.org/packages/05/fc/e527bc606aa2d6848e76cd905b0705dccb4d398a07059442ca100adeeec8/pytest_zafira-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "53ab20ddbca26667944285290a8a89e7", "sha256": "969cfaedb423635b97b1a1a0a0abab15605277664a302cf2778c09feae247e15" }, "downloads": -1, "filename": "pytest-zafira-1.0.3.tar.gz", "has_sig": false, "md5_digest": "53ab20ddbca26667944285290a8a89e7", "packagetype": "sdist", "python_version": "source", "requires_python": "!=2.*.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 21964, "upload_time": "2019-09-18T16:41:26", "url": "https://files.pythonhosted.org/packages/0c/71/60fdba7bdfa59e09c38c44a9806c29397572d6d163ac1c0962b536b60eda/pytest-zafira-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "18cf458e6a18df236231984af9178d52", "sha256": "e478ed2957778a30be1e8ba6d5fe009afdef2eb93c938567f0a5438655b4cbfe" }, "downloads": -1, "filename": "pytest_zafira-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "18cf458e6a18df236231984af9178d52", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "!=2.*.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 26217, "upload_time": "2019-09-18T16:41:23", "url": "https://files.pythonhosted.org/packages/05/fc/e527bc606aa2d6848e76cd905b0705dccb4d398a07059442ca100adeeec8/pytest_zafira-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "53ab20ddbca26667944285290a8a89e7", "sha256": "969cfaedb423635b97b1a1a0a0abab15605277664a302cf2778c09feae247e15" }, "downloads": -1, "filename": "pytest-zafira-1.0.3.tar.gz", "has_sig": false, "md5_digest": "53ab20ddbca26667944285290a8a89e7", "packagetype": "sdist", "python_version": "source", "requires_python": "!=2.*.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 21964, "upload_time": "2019-09-18T16:41:26", "url": "https://files.pythonhosted.org/packages/0c/71/60fdba7bdfa59e09c38c44a9806c29397572d6d163ac1c0962b536b60eda/pytest-zafira-1.0.3.tar.gz" } ] }