Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pytest-spec for openSUSE:Factory checked in at 2022-03-24 22:58:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-spec (Old) and /work/SRC/openSUSE:Factory/.python-pytest-spec.new.1900 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-spec" Thu Mar 24 22:58:11 2022 rev:5 rq:964440 version:3.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-spec/python-pytest-spec.changes 2020-11-06 23:45:16.907242636 +0100 +++ /work/SRC/openSUSE:Factory/.python-pytest-spec.new.1900/python-pytest-spec.changes 2022-03-24 23:00:16.628382404 +0100 @@ -1,0 +2,18 @@ +Thu Mar 24 01:24:23 UTC 2022 - Steve Kowalik <[email protected]> + +- Update to 3.2.0: + * Added support for multiline docstrings + * Added logic to use docstring_summary instead of test name + * Added logic to ignore some tests from spec output + * Changed indicator for skipped tests + * Improve formatting for functions + * Changed actions to test against python and pytest versions + * Added tests to sdist +- Add patch remove-mock.patch: + * Use stdlib unittest.mock +- Correct filelist, and do not install test directory under sitelib. +- Remove mock from {Build,}Requires, add six. +- Drop seperate LICENSE, it's now included. +- Actually run the testsuite. + +------------------------------------------------------------------- Old: ---- LICENSE.txt pytest-spec-3.0.5.tar.gz New: ---- pytest-spec-3.2.0.tar.gz remove-mock.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-spec.spec ++++++ --- /var/tmp/diff_new_pack.uXS15l/_old 2022-03-24 23:00:17.116382875 +0100 +++ /var/tmp/diff_new_pack.uXS15l/_new 2022-03-24 23:00:17.124382883 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-pytest-spec # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,22 +18,22 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pytest-spec -Version: 3.0.5 +Version: 3.2.0 Release: 0 Summary: Plugin to display pytest execution output like a specification License: GPL-2.0-only -Group: Development/Languages/Python URL: https://github.com/pchomik/pytest-spec Source: https://files.pythonhosted.org/packages/source/p/pytest-spec/pytest-spec-%{version}.tar.gz -Source1: https://raw.githubusercontent.com/pchomik/pytest-spec/master/LICENSE.txt +# PATCH-FIX-UPSTREAM gh#pchomik/pytest-spec#51 +Patch0: remove-mock.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-mock >= 1.0.1 +Requires: python-six BuildArch: noarch # SECTION test requirements -BuildRequires: %{python_module mock >= 1.0.1} BuildRequires: %{python_module pytest} +BuildRequires: %{python_module six} # /SECTION %python_subpackages @@ -41,22 +41,22 @@ pytest plugin to display test execution output like a specification. %prep -%setup -q -n pytest-spec-%{version} -cp %{SOURCE1} . +%autosetup -p1 -n pytest-spec-%{version} %build %python_build %install %python_install +# Do not install tests +%python_expand rm -r %{buildroot}%{$python_sitelib}/test %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -# no tests in PyPI tarball, no setup.py in GitHub tarball -#%%pytest +%pytest %files %{python_files} -%doc README.rst +%doc README.md %license LICENSE.txt %{python_sitelib}/* ++++++ pytest-spec-3.0.5.tar.gz -> pytest-spec-3.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/PKG-INFO new/pytest-spec-3.2.0/PKG-INFO --- old/pytest-spec-3.0.5/PKG-INFO 2020-10-11 16:19:27.410657600 +0200 +++ new/pytest-spec-3.2.0/PKG-INFO 2021-05-04 11:03:19.128588400 +0200 @@ -1,7 +1,7 @@ Metadata-Version: 2.1 Name: pytest-spec -Version: 3.0.5 -Summary: pytest plugin to display test execution output like a SPECIFICATION +Version: 3.2.0 +Summary: Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION. Home-page: https://github.com/pchomik/pytest-spec License: GPL-2.0-or-later Keywords: pytest,test,unittest,spec @@ -25,127 +25,166 @@ Classifier: Topic :: Utilities Requires-Dist: six Project-URL: Repository, https://github.com/pchomik/pytest-spec -Description-Content-Type: text/x-rst +Description-Content-Type: text/markdown -pytest-spec -=========== -pytest plugin to display test execution output like a SPECIFICATION. +<p> + <h1 align="center">pytest-spec</h1> + <p align="center"> + <img src="https://badgen.net/badge/python/2.7/green"> + <img src="https://badgen.net/badge/python/3.5/green"> + <img src="https://badgen.net/badge/python/3.6/green"> + <img src="https://badgen.net/badge/python/3.7/green"> + <img src="https://badgen.net/badge/python/3.8/green"> + <img src="https://badgen.net/badge/python/3.9/green"> + </p> + <p align="center"> + <img src="https://badgen.net/badge/os/linux/blue"> + <img src="https://badgen.net/badge/os/windows/blue"> + <img src="https://badgen.net/badge/os/macos/blue"> + </p> + <p align="center"> + <img src="https://badgen.net/badge/pytest/3.9.3/purple"> + <img src="https://badgen.net/badge/pytest/4.6.11/purple"> + <img src="https://badgen.net/badge/pytest/5.4.3/purple"> + <img src="https://badgen.net/badge/pytest/6.1.2/purple"> + </p> + <p align="center"> + Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION. + </p> +</p> -Available features -================== +## Available features + * Format output to look like specification. * Group tests by classes and files * Failed, passed and skipped are marked and colored. * Remove test\_ and underscores for every test. +* It is possible to use docstring summary instead of test name. * Supports function based, class based test. * Supports describe like tests. -Output example -============== - -.. image:: https://github.com/pchomik/pytest-spec/raw/master/docs/output.png +## Output example + -Configuration -============= -``spec_header_format`` ----------------------- +## Configuration -You can configure the format of the test headers by specifying a `format string <https://docs.python.org/2/library/string.html#format-string-syntax>`_ in your `ini-file <http://doc.pytest.org/en/latest/customize.html#inifiles>`_: +### spec_header_format -:: +You can configure the format of the test headers by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](http://doc.pytest.org/en/latest/customize.html#inifiles): - [pytest] +```ini + [tool:pytest] spec_header_format = {module_path}: +``` In addition to the ``{path}`` and ``{class_name}`` replacement fields, there is also ``{test_case}`` that holds a more human readable name. -``spec_test_format`` --------------------- +### spec_test_format -You can configure the format of the test results by specifying a `format string <https://docs.python.org/2/library/string.html#format-string-syntax>`_ in your `ini-file <http://doc.pytest.org/en/latest/customize.html#inifiles>`_: +You can configure the format of the test results by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](http://doc.pytest.org/en/latest/customize.html#inifiles): -:: +3 variables are available: +* result - place for indicator +* name - name of test +* docstring_summary - first line from test docstring if available - [pytest] +```ini + [tool:pytest] spec_test_format = {result} {name} +``` -``spec_success_indicator`` --------------------------- +or -You can configure the indicator displayed when test passed. +```ini + [tool:pytest] + spec_test_format = {result} {docstring_summary} +``` -:: +In second example where docstring is not available the name will be added to spec output. - [pytest] +### spec_success_indicator + +You can configure the indicator displayed when test passed. + +```ini + [tool:pytest] spec_success_indicator = ??? +``` -``spec_failure_indicator`` --------------------------- +### spec_failure_indicator You can configure the indicator displated when test failed. -:: - - [pytest] +```ini + [tool:pytest] spec_failure_indicator = ??? +``` -``spec_skipped_indicator`` --------------------------- +### spec_skipped_indicator You can configure the indicator displated when test is skipped. -:: - - [pytest] +```ini + [tool:pytest] spec_skipped_indicator = ? +``` + +### spec_ignore -``spec_indent`` ---------------- +Comma-separated settings to ignore/hide some tests or output from from plugins like FLAKE8 or ISORT. +Any test which contain provided string will be ignored in output spec. -:: +```ini + [tool:pytest] + spec_ignore = FLAKE8 +``` - [pytest] +### spec_indent + +```ini + [tool:pytest] spec_indent = " " +``` + +## Continuous Integration + +[](https://github.com/pchomik/pytest-spec/actions) + + +## Download -Continuous Integration -====================== -.. image:: https://github.com/pchomik/pytest-spec/workflows/test/badge.svg - :target: https://github.com/pchomik/pytest-spec/actions - -Download -======== -All versions of library are available on official `pypi server <https://pypi.org/project/pytest-spec/#history>`_. - -Install -======= -:: +All versions of library are available on official [pypi server](https://pypi.org/project/pytest-spec/#history). +## Install + +```sh pip install pytest-spec +``` + +## Contribution -Contribution -============ Please feel free to present your idea by code example (pull request) or reported issues. -Contributors -============ -* @0x64746b -* @lucasmarshall -* @amcgregor -* @jhermann -* @frenzymadness -* @chrischambers -* @maxalbert -* @jayvdb +## Contributors + +* [@0x64746b](https://github.com/0x64746b) +* [@lucasmarshall](https://github.com/lucasmarshall) +* [@amcgregor](https://github.com/amcgregor) +* [@jhermann](https://github.com/jhermann) +* [@frenzymadness](https://github.com/frenzymadness) +* [@chrischambers](https://github.com/chrischambers) +* [@maxalbert](https://github.com/maxalbert) +* [@jayvdb](https://github.com/jayvdb) + +## License -License -======= pytest-spec - pytest plugin to display test execution output like a SPECIFICATION. -Copyright (C) 2014-2019 Pawel Chomicki +Copyright (C) 2014-2021 Pawel Chomicki This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/README.md new/pytest-spec-3.2.0/README.md --- old/pytest-spec-3.0.5/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-spec-3.2.0/README.md 2021-05-04 11:02:07.637669300 +0200 @@ -0,0 +1,162 @@ +<p> + <h1 align="center">pytest-spec</h1> + <p align="center"> + <img src="https://badgen.net/badge/python/2.7/green"> + <img src="https://badgen.net/badge/python/3.5/green"> + <img src="https://badgen.net/badge/python/3.6/green"> + <img src="https://badgen.net/badge/python/3.7/green"> + <img src="https://badgen.net/badge/python/3.8/green"> + <img src="https://badgen.net/badge/python/3.9/green"> + </p> + <p align="center"> + <img src="https://badgen.net/badge/os/linux/blue"> + <img src="https://badgen.net/badge/os/windows/blue"> + <img src="https://badgen.net/badge/os/macos/blue"> + </p> + <p align="center"> + <img src="https://badgen.net/badge/pytest/3.9.3/purple"> + <img src="https://badgen.net/badge/pytest/4.6.11/purple"> + <img src="https://badgen.net/badge/pytest/5.4.3/purple"> + <img src="https://badgen.net/badge/pytest/6.1.2/purple"> + </p> + <p align="center"> + Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION. + </p> +</p> + + +## Available features + +* Format output to look like specification. +* Group tests by classes and files +* Failed, passed and skipped are marked and colored. +* Remove test\_ and underscores for every test. +* It is possible to use docstring summary instead of test name. +* Supports function based, class based test. +* Supports describe like tests. + + +## Output example + + + + +## Configuration + +### spec_header_format + +You can configure the format of the test headers by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](http://doc.pytest.org/en/latest/customize.html#inifiles): + +```ini + [tool:pytest] + spec_header_format = {module_path}: +``` + +In addition to the ``{path}`` and ``{class_name}`` replacement fields, there is also ``{test_case}`` that holds a more human readable name. + +### spec_test_format + +You can configure the format of the test results by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](http://doc.pytest.org/en/latest/customize.html#inifiles): + +3 variables are available: +* result - place for indicator +* name - name of test +* docstring_summary - first line from test docstring if available + +```ini + [tool:pytest] + spec_test_format = {result} {name} +``` + +or + +```ini + [tool:pytest] + spec_test_format = {result} {docstring_summary} +``` + +In second example where docstring is not available the name will be added to spec output. + +### spec_success_indicator + +You can configure the indicator displayed when test passed. + +```ini + [tool:pytest] + spec_success_indicator = ??? +``` + +### spec_failure_indicator + +You can configure the indicator displated when test failed. + +```ini + [tool:pytest] + spec_failure_indicator = ??? +``` + +### spec_skipped_indicator + +You can configure the indicator displated when test is skipped. + +```ini + [tool:pytest] + spec_skipped_indicator = ? +``` + +### spec_ignore + +Comma-separated settings to ignore/hide some tests or output from from plugins like FLAKE8 or ISORT. +Any test which contain provided string will be ignored in output spec. + +```ini + [tool:pytest] + spec_ignore = FLAKE8 +``` + +### spec_indent + +```ini + [tool:pytest] + spec_indent = " " +``` + +## Continuous Integration + +[](https://github.com/pchomik/pytest-spec/actions) + + +## Download + +All versions of library are available on official [pypi server](https://pypi.org/project/pytest-spec/#history). + +## Install + +```sh + pip install pytest-spec +``` + +## Contribution + +Please feel free to present your idea by code example (pull request) or reported issues. + +## Contributors + +* [@0x64746b](https://github.com/0x64746b) +* [@lucasmarshall](https://github.com/lucasmarshall) +* [@amcgregor](https://github.com/amcgregor) +* [@jhermann](https://github.com/jhermann) +* [@frenzymadness](https://github.com/frenzymadness) +* [@chrischambers](https://github.com/chrischambers) +* [@maxalbert](https://github.com/maxalbert) +* [@jayvdb](https://github.com/jayvdb) + +## License + +pytest-spec - pytest plugin to display test execution output like a SPECIFICATION. + +Copyright (C) 2014-2021 Pawel Chomicki + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/README.rst new/pytest-spec-3.2.0/README.rst --- old/pytest-spec-3.0.5/README.rst 2020-10-11 16:18:36.371369100 +0200 +++ new/pytest-spec-3.2.0/README.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,123 +0,0 @@ -pytest-spec -=========== -pytest plugin to display test execution output like a SPECIFICATION. - - -Available features -================== -* Format output to look like specification. -* Group tests by classes and files -* Failed, passed and skipped are marked and colored. -* Remove test\_ and underscores for every test. -* Supports function based, class based test. -* Supports describe like tests. - - -Output example -============== - -.. image:: https://github.com/pchomik/pytest-spec/raw/master/docs/output.png - - -Configuration -============= - -``spec_header_format`` ----------------------- - -You can configure the format of the test headers by specifying a `format string <https://docs.python.org/2/library/string.html#format-string-syntax>`_ in your `ini-file <http://doc.pytest.org/en/latest/customize.html#inifiles>`_: - -:: - - [pytest] - spec_header_format = {module_path}: - -In addition to the ``{path}`` and ``{class_name}`` replacement fields, there is also ``{test_case}`` that holds a more human readable name. - -``spec_test_format`` --------------------- - -You can configure the format of the test results by specifying a `format string <https://docs.python.org/2/library/string.html#format-string-syntax>`_ in your `ini-file <http://doc.pytest.org/en/latest/customize.html#inifiles>`_: - -:: - - [pytest] - spec_test_format = {result} {name} - -``spec_success_indicator`` --------------------------- - -You can configure the indicator displayed when test passed. - -:: - - [pytest] - spec_success_indicator = ??? - -``spec_failure_indicator`` --------------------------- - -You can configure the indicator displated when test failed. - -:: - - [pytest] - spec_failure_indicator = ??? - -``spec_skipped_indicator`` --------------------------- - -You can configure the indicator displated when test is skipped. - -:: - - [pytest] - spec_skipped_indicator = ? - -``spec_indent`` ---------------- - -:: - - [pytest] - spec_indent = " " - -Continuous Integration -====================== -.. image:: https://github.com/pchomik/pytest-spec/workflows/test/badge.svg - :target: https://github.com/pchomik/pytest-spec/actions - -Download -======== -All versions of library are available on official `pypi server <https://pypi.org/project/pytest-spec/#history>`_. - -Install -======= -:: - - pip install pytest-spec - -Contribution -============ -Please feel free to present your idea by code example (pull request) or reported issues. - -Contributors -============ -* @0x64746b -* @lucasmarshall -* @amcgregor -* @jhermann -* @frenzymadness -* @chrischambers -* @maxalbert -* @jayvdb - -License -======= -pytest-spec - pytest plugin to display test execution output like a SPECIFICATION. - -Copyright (C) 2014-2019 Pawel Chomicki - -This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/pyproject.toml new/pytest-spec-3.2.0/pyproject.toml --- old/pytest-spec-3.0.5/pyproject.toml 2020-10-11 16:18:36.371369100 +0200 +++ new/pytest-spec-3.2.0/pyproject.toml 2021-05-04 11:02:07.645670400 +0200 @@ -1,8 +1,8 @@ [tool.poetry] name = "pytest-spec" -version = "3.0.5" -description = "pytest plugin to display test execution output like a SPECIFICATION" -readme = "README.rst" +version = "3.2.0" +description = "Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION." +readme = "README.md" authors = ["Pawel Chomicki <[email protected]>"] license = "GPL-2.0-or-later" homepage = "https://github.com/pchomik/pytest-spec" @@ -13,6 +13,7 @@ "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", @@ -22,6 +23,11 @@ "Topic :: Software Development :: Testing", "Topic :: Utilities" ] +packages = [ + { include = "pytest_spec" }, + { include = "test", format = "sdist" }, +] +include = ["LICENSE.txt"] [tool.poetry.dependencies] six = "*" @@ -38,6 +44,9 @@ [tool.poetry.plugins.pytest11] pytest_spec = "pytest_spec.plugin" +[tool.poetry2conda] +name = "pytest-spec-env" + [build-system] requires = ["poetry>=0.12"] build-backend = "poetry.masonry.api" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/pytest_spec/patch.py new/pytest-spec-3.2.0/pytest_spec/patch.py --- old/pytest-spec-3.0.5/pytest_spec/patch.py 2020-10-11 16:18:36.371369100 +0200 +++ new/pytest-spec-3.2.0/pytest_spec/patch.py 2021-05-04 11:02:07.645670400 +0200 @@ -3,7 +3,6 @@ :author: Pawel Chomicki """ - import os import re @@ -59,6 +58,8 @@ res = self.config.hook.pytest_report_teststatus(report=report, config=self.config) cat, letter, word = res self.stats.setdefault(cat, []).append(report) + if _is_ignored(report.nodeid, self.config.getini('spec_ignore').split(',')): + return if not letter and not word: return if not _is_nodeid_has_test(report.nodeid): @@ -80,9 +81,19 @@ if not isinstance(word, tuple): test_name = _get_test_name(report.nodeid) + docstring_summary = getattr(report, 'docstring_summary', '') + docstring_summary = docstring_summary if docstring_summary else test_name markup, test_status = _format_results(report, self.config) - depth = len(self.current_scopes) - _print_test_result(self, test_name, test_status, markup, depth) + depth = len(self.current_scopes) or 1 + _print_test_result(self, test_name, docstring_summary, test_status, markup, depth) + + +def _is_ignored(nodeid, ignore_strings): + if ignore_strings: + for ignore_string in ignore_strings: + if ignore_string and ignore_string in nodeid: + return True + return False def _is_nodeid_has_test(nodeid): @@ -188,11 +199,11 @@ return {'yellow': True}, skipped_indicator -def _print_test_result(self, test_name, test_status, markup, depth): +def _print_test_result(self, test_name, docstring_summary, test_status, markup, depth): indent = self.config.getini('spec_indent') self._tw.line() self._tw.write( indent * depth + self.config.getini('spec_test_format').format( - result=test_status, name=test_name + result=test_status, name=test_name, docstring_summary=docstring_summary ), **markup ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/pytest_spec/plugin.py new/pytest-spec-3.2.0/pytest_spec/plugin.py --- old/pytest-spec-3.0.5/pytest_spec/plugin.py 2020-10-11 16:18:36.371369100 +0200 +++ new/pytest-spec-3.2.0/pytest_spec/plugin.py 2021-05-04 11:02:07.645670400 +0200 @@ -3,6 +3,8 @@ :author: Pawel Chomicki """ +import pytest + from .replacer import logstart_replacer, report_replacer, modifyitems_replacer @@ -38,7 +40,7 @@ ) parser.addini( 'spec_skipped_indicator', - default='?', + default='??', help='The indicator displayed when a test is skipped' ) parser.addini( @@ -46,6 +48,11 @@ default=' ', help='The string used for indentation in the spec output' ) + parser.addini( + 'spec_ignore', + default='', + help='The comma-separated list of strings used to ignore tests in the spec output e.g. FLAKE8' + ) def pytest_configure(config): @@ -56,3 +63,12 @@ _pytest.terminal.TerminalReporter.pytest_runtest_logreport = report_replacer _pytest.terminal.TerminalReporter.pytest_collection_modifyitems = modifyitems_replacer six.moves.reload_module(_pytest) + + [email protected] +def pytest_runtest_makereport(item, call): + outcome = yield + report = outcome.get_result() + node = getattr(item, 'obj', None) + if node and item.obj.__doc__: + report.docstring_summary = str(item.obj.__doc__).lstrip().split("\n")[0].strip() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/setup.py new/pytest-spec-3.2.0/setup.py --- old/pytest-spec-3.0.5/setup.py 2020-10-11 16:19:27.410267000 +0200 +++ new/pytest-spec-3.2.0/setup.py 2021-05-04 11:03:19.127931400 +0200 @@ -2,7 +2,7 @@ from setuptools import setup packages = \ -['pytest_spec'] +['pytest_spec', 'test', 'test.test_formats', 'test.test_results'] package_data = \ {'': ['*']} @@ -15,9 +15,9 @@ setup_kwargs = { 'name': 'pytest-spec', - 'version': '3.0.5', - 'description': 'pytest plugin to display test execution output like a SPECIFICATION', - 'long_description': 'pytest-spec\n===========\npytest plugin to display test execution output like a SPECIFICATION.\n\n\nAvailable features\n==================\n* Format output to look like specification.\n* Group tests by classes and files\n* Failed, passed and skipped are marked and colored.\n* Remove test\\_ and underscores for every test.\n* Supports function based, class based test.\n* Supports describe like tests.\n\n\nOutput example\n==============\n\n.. image:: https://github.com/pchomik/pytest-spec/raw/master/docs/output.png\n\n\nConfiguration\n=============\n\n``spec_header_format``\n----------------------\n\nYou can configure the format of the test headers by specifying a `format string <https://docs.python.org/2/library/string.html#format-string-syntax>`_ in your `ini-file <http://doc.pytest.org/en/latest/customize.html#inifiles>`_:\n\n::\n\n [pytest]\n spec_header_format = {module_path}:\n\nIn addition to the ``{path}`` and ``{class_name}`` replacement fields, there is also ``{test_case}`` that holds a more human readable name.\n\n``spec_test_format``\n--------------------\n\nYou can configure the format of the test results by specifying a `format string <https://docs.python.org/2/library/string.html#format-string-syntax>`_ in your `ini-file <http://doc.pytest.org/en/latest/customize.html#inifiles>`_:\n\n::\n\n [pytest]\n spec_test_format = {result} {name}\n\n``spec_success_indicator``\n--------------------------\n\nYou can configure the indicator displayed when test passed.\n\n::\n\n [pytest]\n spec_success_indicator = ???\n\n``spec_failure_indicator``\n--------------------------\n\nYou can configure the indicator displated when test failed.\n\n::\n\n [pytest]\n spec_failure_indicator = ???\n\n``spec_skipped_indicator``\n--------------------------\n\nYou can configure the indicator displated when test is skipped.\n\n::\n\n [pytest]\n spec_skipped_indicator = ?\n\n``spec_indent``\n---------------\n\n::\n\n [pyt est]\n spec_indent = " "\n\nContinuous Integration\n======================\n.. image:: https://github.com/pchomik/pytest-spec/workflows/test/badge.svg\n :target: https://github.com/pchomik/pytest-spec/actions\n\nDownload\n========\nAll versions of library are available on official `pypi server <https://pypi.org/project/pytest-spec/#history>`_.\n\nInstall\n=======\n::\n\n pip install pytest-spec\n\nContribution\n============\nPlease feel free to present your idea by code example (pull request) or reported issues.\n\nContributors\n============\n* @0x64746b\n* @lucasmarshall\n* @amcgregor\n* @jhermann\n* @frenzymadness\n* @chrischambers\n* @maxalbert\n* @jayvdb\n\nLicense\n=======\npytest-spec - pytest plugin to display test execution output like a SPECIFICATION.\n\nCopyright (C) 2014-2019 Pawel Chomicki\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; e ither version 2 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n', + 'version': '3.2.0', + 'description': 'Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.', + 'long_description': '<p>\n <h1 align="center">pytest-spec</h1>\n <p align="center">\n <img src="https://badgen.net/badge/python/2.7/green">\n <img src="https://badgen.net/badge/python/3.5/green">\n <img src="https://badgen.net/badge/python/3.6/green">\n <img src="https://badgen.net/badge/python/3.7/green">\n <img src="https://badgen.net/badge/python/3.8/green">\n <img src="https://badgen.net/badge/python/3.9/green">\n </p>\n <p align="center">\n <img src="https://badgen.net/badge/os/linux/blue">\n <img src="https://badgen.net/badge/os/windows/blue">\n <img src="https://badgen.net/badge/os/macos/blue">\n </p>\n <p align="center">\n <img src="https://badgen.net/badge/pytest/3.9.3/purple">\n <img src="https://badgen.net/badge/pytest/4.6.11/purple">\n <img src="https://badgen.net/badge/pytest/5.4.3/purple">\n <img src="https://badgen.net/badge/pytest/6.1.2/purple">\n </p>\ n <p align="center">\n Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.\n </p>\n</p>\n\n\n## Available features\n\n* Format output to look like specification.\n* Group tests by classes and files\n* Failed, passed and skipped are marked and colored.\n* Remove test\\_ and underscores for every test.\n* It is possible to use docstring summary instead of test name.\n* Supports function based, class based test.\n* Supports describe like tests.\n\n\n## Output example\n\n\n\n\n## Configuration\n\n### spec_header_format\n\nYou can configure the format of the test headers by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](http://doc.pytest.org/en/latest/customize.html#inifiles):\n\n```ini\n [tool:pytest]\n spec_header_format = {module_path}:\n```\n\nIn addition to the ``{path}`` and ``{ class_name}`` replacement fields, there is also ``{test_case}`` that holds a more human readable name.\n\n### spec_test_format\n\nYou can configure the format of the test results by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](http://doc.pytest.org/en/latest/customize.html#inifiles):\n\n3 variables are available:\n* result - place for indicator\n* name - name of test\n* docstring_summary - first line from test docstring if available\n\n```ini\n [tool:pytest]\n spec_test_format = {result} {name}\n```\n\nor\n\n```ini\n [tool:pytest]\n spec_test_format = {result} {docstring_summary}\n```\n\nIn second example where docstring is not available the name will be added to spec output.\n\n### spec_success_indicator\n\nYou can configure the indicator displayed when test passed.\n\n```ini\n [tool:pytest]\n spec_success_indicator = ???\n```\n\n### spec_failure_indicator\n\nYou can configure the indicator dis plated when test failed.\n\n```ini\n [tool:pytest]\n spec_failure_indicator = ???\n```\n\n### spec_skipped_indicator\n\nYou can configure the indicator displated when test is skipped.\n\n```ini\n [tool:pytest]\n spec_skipped_indicator = ?\n```\n\n### spec_ignore\n\nComma-separated settings to ignore/hide some tests or output from from plugins like FLAKE8 or ISORT.\nAny test which contain provided string will be ignored in output spec.\n\n```ini\n [tool:pytest]\n spec_ignore = FLAKE8\n```\n\n### spec_indent\n\n```ini\n [tool:pytest]\n spec_indent = " "\n```\n\n## Continuous Integration\n\n[](https://github.com/pchomik/pytest-spec/actions)\n\n\n## Download\n\nAll versions of library are available on official [pypi server](https://pypi.org/project/pytest-spec/#history).\n\n## Install\n\n```sh\n pip install pytest-spec\n```\n\n## Contribution\n\nPlease feel free to present your idea by code example (pull request) or reported issues.\n\n## Contributors\n\n* [@0x64746b](https://github.com/0x64746b)\n* [@lucasmarshall](https://github.com/lucasmarshall)\n* [@amcgregor](https://github.com/amcgregor)\n* [@jhermann](https://github.com/jhermann)\n* [@frenzymadness](https://github.com/frenzymadness)\n* [@chrischambers](https://github.com/chrischambers)\n* [@maxalbert](https://github.com/maxalbert)\n* [@jayvdb](https://github.com/jayvdb)\n\n## License\n\npytest-spec - pytest plugin to display test execution output like a SPECIFICATION.\n\nCopyright (C) 2014-2021 Pawel Chomicki\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n', 'author': 'Pawel Chomicki', 'author_email': '[email protected]', 'maintainer': None, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/test/test_formats/test_describe_format.py new/pytest-spec-3.2.0/test/test_formats/test_describe_format.py --- old/pytest-spec-3.0.5/test/test_formats/test_describe_format.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-spec-3.2.0/test/test_formats/test_describe_format.py 2021-05-04 11:02:07.649671000 +0200 @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +""" +:author: Pawel Chomicki +:e-mail: [email protected] +""" +import unittest + + +def describe_first_level(): + + def it_passed_on_first_level(): + assert True is True + + @unittest.skip('To implement') + def it_skipped_on_first_level(): + assert True is True + + @unittest.skip('Remove docorator to see fail result') + def it_failed_on_first_level(): + assert True is False + + def it_passed_with_custom_message_on_first_level(): + """Shows custom message from docstring summary""" + assert True is True + + def it_passed_with_multiline_docstring_on_first_level(): + """ + Shows custom multiline message from docstring summary + + And doesn't show additional info. + """ + assert True is True + + def describe_second_level(): + + def it_passed_on_second_level(): + assert True is True + + @unittest.skip('To implement') + def it_skipped_on_second_level(): + assert True is True + + @unittest.skip('Remove docorator to see fail result') + def it_failed_on_second_level(): + assert True is False + + def it_passed_with_custom_message_on_second_level(): + """Shows custom message from docstring summary""" + assert True is True + + def it_passed_with_multiline_docstring_on_second_level(): + """ + Shows custom multiline message from docstring summary + + And doesn't show additional info. + """ + assert True is True + + def describe_third_level(): + + def it_passed_on_third_level(): + assert True is True + + @unittest.skip('To implement') + def it_skipped_on_third_level(): + assert True is True + + @unittest.skip('Remove docorator to see fail result') + def it_failed_on_third_level(): + assert True is False + + def it_passed_with_custom_message_on_third_level(): + """Shows custom message from docstring summary""" + assert True is True + + def it_passed_with_multiline_docstring_on_third_level(): + """ + Shows custom multiline message from docstring summary + + And doesn't show additional info. + """ + assert True is True + + def describe_second_level_again(): + + def it_passed_on_second_level(): + assert True is True + + @unittest.skip('To implement') + def it_skipped_on_second_level(): + assert True is True + + @unittest.skip('Remove docorator to see fail result') + def it_failed_on_second_level(): + assert True is False + + +def describe_first_level_again(): + + def it_passed_on_first_level(): + assert True is True + + @unittest.skip('To implement') + def it_skipped_on_first_level(): + assert True is True + + @unittest.skip('Remove docorator to see fail result') + def it_failed_on_first_level(): + assert True is False + + +if __name__ == '__main__': + unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/test/test_formats/test_functions.py new/pytest-spec-3.2.0/test/test_formats/test_functions.py --- old/pytest-spec-3.0.5/test/test_formats/test_functions.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-spec-3.2.0/test/test_formats/test_functions.py 2021-05-04 11:02:07.649671000 +0200 @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +""" +:author: Pawel Chomicki +:e-mail: [email protected] +""" +import unittest + + +def some_function(arg): + return arg + + +def test__some_function__returns_none(): + """Some func""" + assert some_function(None) is None + + +def test_some_function__single_underscore_as_prefix(): + assert some_function(None) is None + + +def test__some_function_single_underscore_as_suffix(): + assert some_function(None) is None + + +def test_with_custom_description(): + """Shows custom message from docstring summary""" + assert some_function(None) is None + + +def test_with_multiline_docstring(): + """ + Shows custom message from docstring summary + + And doesn't show additional info. + """ + assert some_function(None) is None + + +if __name__ == '__main__': + unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/test/test_formats/test_methods.py new/pytest-spec-3.2.0/test/test_formats/test_methods.py --- old/pytest-spec-3.0.5/test/test_formats/test_methods.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-spec-3.2.0/test/test_formats/test_methods.py 2021-05-04 11:02:07.649671000 +0200 @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +""" +:author: Pawel Chomicki +:e-mail: [email protected] +""" +import unittest + + +class SomeClass(object): + def some_method(self, arg): + return arg + + +class TestFormats(unittest.TestCase): + def test__some_method__returns_none(self): + assert SomeClass().some_method(None) is None + + def test_some_method__single_underscore_as_prefix(self): + assert SomeClass().some_method(None) is None + + def test__some_method_single_underscore_as_suffix(self): + assert SomeClass().some_method(None) is None + + def test_with_custom_message(self): + """Shows custom message from docstring summary""" + assert SomeClass().some_method(None) is None + + def test_with_multiline_docstring(self): + """ + Shows custom message from docstring summary + + And doesn't show additional info. + """ + assert SomeClass().some_method(None) is None + + +if __name__ == '__main__': + unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/test/test_patch.py new/pytest-spec-3.2.0/test/test_patch.py --- old/pytest-spec-3.0.5/test/test_patch.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-spec-3.2.0/test/test_patch.py 2021-05-04 11:02:07.649671000 +0200 @@ -0,0 +1,178 @@ +# -*- coding: utf-8 -*- +""" +:author: Pawel Chomicki +""" +import unittest + +from mock import Mock, call + +import pytest_spec +from pytest_spec.patch import pytest_runtest_logstart, pytest_runtest_logreport + + +class FakeHook(object): + def __init__(self, *args, **kwargs): + self.cat = kwargs.get('cat', ' ') + self.letter = kwargs.get('letter', ' ') + self.word = kwargs.get('word', ' ') + + def pytest_report_teststatus(self, report, config): + return self.cat, self.letter, self.word + + +class FakeConfig(object): + + def __init__(self, *args, **kwargs): + self.hook = FakeHook(*args, **kwargs) + self.mapping = { + 'spec_header_format': '{module_path}:', + 'spec_test_format': '{result} {name}', + 'spec_success_indicator': '???', + 'spec_failure_indicator': '???', + 'spec_skipped_indicator': '?', + 'spec_indent': ' ', + 'spec_ignore': 'FLAKE8' + } + + def getini(self, option): + result = self.mapping.get(option, None) + if not result: + raise TypeError('Option {} is not supported in the test'.format( + option) + ) + return result + + +class FakeStats(object): + def setdefault(self, first, second): + return [] + + +class FakeSelf(object): + def __init__(self, *args, **kwargs): + self.config = FakeConfig(*args, **kwargs) + self.currentfspath = None + self._tw = Mock() + self.stats = FakeStats() + + +class FakeReport(object): + def __init__(self, nodeid, *args, **kwargs): + self.nodeid = nodeid + self.passed = kwargs.get('passed', True) + self.failed = kwargs.get('failed', False) + self.skipped = kwargs.get('skipped', False) + self.docstring_summary = "Test documentation" + + +class TestPatch(unittest.TestCase): + + def tearDown(self): + pytest_spec.patch.docstring_summaries = dict() + + def test__pytest_runtest_logstart__returns_none(self): + self.assertEqual(pytest_runtest_logstart('self', 'nodeid', 'location'), None) + + def test__pytest_runtest_logreport__returns_none_when_letter_is_missing(self): + result = pytest_runtest_logreport(FakeSelf(letter=''), FakeReport('Test::Second::Test_example_demo')) + self.assertIsNone(result) + + def test__pytest_runtest_logreport__returns_none_when_word_is_missing(self): + result = pytest_runtest_logreport(FakeSelf(word=''), FakeReport('Test::Second::Test_example_demo')) + self.assertIsNone(result) + + def test__pytest_runtest_logreport__returns_none_when_nodeid_is_wrong_formatted(self): + result = pytest_runtest_logreport(FakeSelf(), FakeReport('')) + self.assertIsNone(result) + + def test__pytest_runtest_logreport__prints_class_name_before_first_test_result(self): + fake_self = FakeSelf() + pytest_runtest_logreport(fake_self, FakeReport('Test::Second::Test_example_demo')) + fake_self._tw.write.assert_has_calls([call('Second:')]) + + def test__pytest_runtest_logreport__prints_test_name_and_passed_status(self): + fake_self = FakeSelf() + pytest_runtest_logreport(fake_self, FakeReport('Test::Second::test_example_demo')) + fake_self._tw.write.assert_has_calls([ + call('Second:'), + call(' ??? Example demo', green=True) + ]) + + def test__pytest_runtest_logreport__prints_test_name_and_failed_status(self): + fake_self = FakeSelf() + pytest_runtest_logreport(fake_self, FakeReport('Test::Second::test_example_demo', passed=False, failed=True)) + fake_self._tw.write.assert_has_calls([ + call('Second:'), + call(' ??? Example demo', red=True) + ]) + + def test__pytest_runtest_logreport__prints_test_name_and_skipped_status(self): + fake_self = FakeSelf() + pytest_runtest_logreport(fake_self, FakeReport('Test::Second::test_example_demo', passed=False, skipped=True)) + fake_self._tw.write.assert_has_calls([ + call('Second:'), + call(' ? Example demo', yellow=True) + ]) + + def test__pytest_runtest_logreport__skips_empty_line_for_first_test(self): + fake_self = FakeSelf() + pytest_runtest_logreport(fake_self, FakeReport('Test::Second::test_example_demo')) + with self.assertRaises(AssertionError): + fake_self._tw.write.assert_has_calls([call.line(), call.line()]) + + def test__pytest_runtest_logreport__marks_method_marked_by_double_underscores(self): + fake_self = FakeSelf() + pytest_runtest_logreport(fake_self, FakeReport('Test::Second::test__example__demo')) + fake_self._tw.write.assert_has_calls([ + call('Second:'), + call(' ??? Example demo', green=True) + ]) + + def test__pytest_runtest_logreport__prints_test_name_and_handle_only_single_marker(self): + fake_self = FakeSelf() + pytest_runtest_logreport(fake_self, FakeReport('Test::Second::test__example')) + fake_self._tw.write.assert_has_calls([ + call('Second:'), + call(' ??? Example', green=True) + ]) + + def test__pytest_runtest_logreport__honors_capitalization_of_words_in_test_name(self): + fake_self = FakeSelf() + pytest_runtest_logreport(fake_self, FakeReport('Test::Second::test_example_Demo_CamelCase')) + fake_self._tw.write.assert_has_calls([ + call('Second:'), + call(' ??? Example Demo CamelCase', green=True) + ]) + + def test__pytest_runtest_longreport__uses_docstring_summary(self): + fake_self = FakeSelf() + fake_self.config.mapping['spec_test_format'] = "{result} {docstring_summary}" + pytest_runtest_logreport(fake_self, FakeReport('Test::Second::test_example_Demo_CamelCase')) + fake_self._tw.write.assert_has_calls([ + call(' ??? Test documentation', green=True) + ]) + + def test__pytest_runtest_longreport__uses_test_name_as_docstring_summary_if_missing(self): + fake_self = FakeSelf() + fake_self.config.mapping['spec_test_format'] = "{result} {docstring_summary}" + fake_report = FakeReport('Test::Second::test_example_Demo_CamelCase') + fake_report.docstring_summary = None + pytest_runtest_logreport(fake_self, fake_report) + fake_self._tw.write.assert_has_calls([ + call(' ??? Example Demo CamelCase', green=True) + ]) + + def test__pytest_runtest_logreport__ignores_nodeid_which_matches_ignore_string(self): + fake_self = FakeSelf() + pytest_runtest_logreport(fake_self, FakeReport('Test::FLAKE8')) + assert not fake_self._tw.write.mock_calls + + def test__pytest_runtest_logreport__ignores_nodeid_if_multiple_string_ignore_are_provided(self): + fake_self = FakeSelf() + fake_self.config.mapping['spec_ignore'] = "FLAKE8,Something" + pytest_runtest_logreport(fake_self, FakeReport('Something')) + assert not fake_self._tw.write.called + + +if __name__ == '__main__': + unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/test/test_plugin.py new/pytest-spec-3.2.0/test/test_plugin.py --- old/pytest-spec-3.0.5/test/test_plugin.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-spec-3.2.0/test/test_plugin.py 2021-05-04 11:02:07.649671000 +0200 @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +""" +:author: Pawel Chomicki +""" +import unittest + +from mock import Mock, call, patch +from pytest_spec.plugin import pytest_addoption, pytest_configure + + +class FakeOption(object): + def __init__(self, spec=False): + self.spec = spec + self.verbose = 0 + + +class FakeConfig(object): + def __init__(self, spec): + self.option = FakeOption(spec=spec) + + +class TestPlugin(unittest.TestCase): + def setUp(self): + self.mock = Mock() + + def test__pytest_adoption__gets_general_group(self): + pytest_addoption(self.mock) + self.mock.assert_has_calls([call.getgroup('general')]) + + def test__pytest_adoption__adds_spec_option(self): + pytest_addoption(self.mock) + self.mock.assert_has_calls([call.getgroup().addoption('--spec', + action='store_true', + dest='spec', + help='Print test result in specification format')]) + + @patch('six.moves.reload_module') + def test__pytest_configure__should_not_reload_configuration(self, imp_mock): + pytest_configure(FakeConfig(spec=False)) + self.assertEqual(len(imp_mock.mock_calls), 0) + + @patch('six.moves.reload_module') + def test__pytest_configure__reloads_pytest_after_patching(self, imp_mock): + pytest_configure(FakeConfig(spec=True)) + self.assertEqual(len(imp_mock.mock_calls), 1) + + +if __name__ == '__main__': + unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/test/test_replacer.py new/pytest-spec-3.2.0/test/test_replacer.py --- old/pytest-spec-3.0.5/test/test_replacer.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-spec-3.2.0/test/test_replacer.py 2021-05-04 11:02:07.649671000 +0200 @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +""" +:author: Pawel Chomicki +""" +import unittest + +from mock import patch +from pytest_spec.replacer import logstart_replacer, report_replacer + + +class TestPatcher(unittest.TestCase): + @patch('pytest_spec.replacer.pytest_runtest_logstart') + def test__logstart_replacer__returns_result_of_pytest_runtest_logstart_method(self, method_mock): + method_mock.return_value = 'test' + result = logstart_replacer('self', 'nodeid', 'location') + self.assertEqual(result, 'test') + + @patch('pytest_spec.replacer.pytest_runtest_logreport') + def test__report_replacer__returns_result_of_pytest_runtest_logreport_method(self, method_mock): + method_mock.return_value = 'test' + result = report_replacer('self', 'report') + self.assertEqual(result, 'test') + + +if __name__ == '__main__': + unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/test/test_results/test_as_class.py new/pytest-spec-3.2.0/test/test_results/test_as_class.py --- old/pytest-spec-3.0.5/test/test_results/test_as_class.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-spec-3.2.0/test/test_results/test_as_class.py 2021-05-04 11:02:07.649671000 +0200 @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +""" +:author: Pawel Chomicki +:e-mail: [email protected] +""" +import unittest + + +def some_method(arg): + return arg + + +class TestResults(unittest.TestCase): + def test__some_method__returns_true(self): + assert some_method(True) is True + + @unittest.skip('Remove docorator to see fail result') + def test__some_method__returns_false(self): + assert some_method(True) is False + + @unittest.skip('To implement') + def test__some_method__return_none(self): + assert some_method(True) is None + + +if __name__ == '__main__': + unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-spec-3.0.5/test/test_results/test_as_functions.py new/pytest-spec-3.2.0/test/test_results/test_as_functions.py --- old/pytest-spec-3.0.5/test/test_results/test_as_functions.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-spec-3.2.0/test/test_results/test_as_functions.py 2021-05-04 11:02:07.649671000 +0200 @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +""" +:author: Pawel Chomicki +:e-mail: [email protected] +""" +import unittest + + +def some_method(arg): + return arg + + +def test__some_method__returns_true(): + assert some_method(True) is True + + [email protected]('Remove docorator to see fail result') +def test__some_method__returns_false(): + assert some_method(True) is False + + [email protected]('To implement') +def test__some_method__return_none(): + assert some_method(True) is None + + +if __name__ == '__main__': + unittest.main() ++++++ remove-mock.patch ++++++ >From 811abee39d7fae705c0b9b2e0598bc0fd4f96c36 Mon Sep 17 00:00:00 2001 From: Steve Kowalik <[email protected]> Date: Wed, 23 Mar 2022 18:00:06 +1100 Subject: [PATCH] Also support stdlib mock Python >=3.3 has included mock in the standard library, so try and import that before falling back to the external mock. --- pyproject.toml | 2 +- test/test_patch.py | 5 ++++- test/test_plugin.py | 5 ++++- test/test_replacer.py | 5 ++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ca689f9..448d9ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ include = ["LICENSE.txt"] six = "*" [tool.poetry.dev-dependencies] -mock = ">1.0.1" +mock = { version = ">1.0.1", python = "~2.7" } pytest = "*" pytest-describe = "*" pytest-flake8 = "*" diff --git a/test/test_patch.py b/test/test_patch.py index 05ec407..bf9fbcf 100644 --- a/test/test_patch.py +++ b/test/test_patch.py @@ -4,7 +4,10 @@ """ import unittest -from mock import Mock, call +try: + from unittest.mock import Mock, call +except ImportError: + from mock import Mock, call import pytest_spec from pytest_spec.patch import pytest_runtest_logstart, pytest_runtest_logreport diff --git a/test/test_plugin.py b/test/test_plugin.py index 2bcaec4..ca95800 100755 --- a/test/test_plugin.py +++ b/test/test_plugin.py @@ -4,7 +4,10 @@ """ import unittest -from mock import Mock, call, patch +try: + from unittest.mock import Mock, call, patch +except ImportError: + from mock import Mock, call, patch from pytest_spec.plugin import pytest_addoption, pytest_configure diff --git a/test/test_replacer.py b/test/test_replacer.py index 9526bc1..a805f83 100644 --- a/test/test_replacer.py +++ b/test/test_replacer.py @@ -4,7 +4,10 @@ """ import unittest -from mock import patch +try: + from unittest.mock import patch +except ImportError: + from mock import patch from pytest_spec.replacer import logstart_replacer, report_replacer
