Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pytest-subtests for openSUSE:Factory checked in at 2021-10-08 00:06:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-subtests (Old) and /work/SRC/openSUSE:Factory/.python-pytest-subtests.new.2443 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-subtests" Fri Oct 8 00:06:12 2021 rev:6 rq:923685 version:0.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-subtests/python-pytest-subtests.changes 2021-04-01 14:18:03.352049549 +0200 +++ /work/SRC/openSUSE:Factory/.python-pytest-subtests.new.2443/python-pytest-subtests.changes 2021-10-08 00:07:08.657864577 +0200 @@ -1,0 +2,6 @@ +Thu Oct 7 09:36:20 UTC 2021 - Pedro Monreal <pmonr...@suse.com> + +- Update to 0.5.0 + * Add support for pytest.mark.xfail + +------------------------------------------------------------------- Old: ---- pytest-subtests-0.4.0.tar.gz New: ---- pytest-subtests-0.5.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-subtests.spec ++++++ --- /var/tmp/diff_new_pack.Vddox3/_old 2021-10-08 00:07:09.169865446 +0200 +++ /var/tmp/diff_new_pack.Vddox3/_new 2021-10-08 00:07:09.169865446 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-pytest-subtests -Version: 0.4.0 +Version: 0.5.0 Release: 0 Summary: Python unittest subTest() support and subtests fixture License: MIT ++++++ pytest-subtests-0.4.0.tar.gz -> pytest-subtests-0.5.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-subtests-0.4.0/.github/workflows/main.yml new/pytest-subtests-0.5.0/.github/workflows/main.yml --- old/pytest-subtests-0.4.0/.github/workflows/main.yml 2020-12-13 14:33:05.000000000 +0100 +++ new/pytest-subtests-0.5.0/.github/workflows/main.yml 2021-05-29 15:08:15.000000000 +0200 @@ -24,8 +24,6 @@ "ubuntu-py38", "ubuntu-py39", "ubuntu-py38-pytest53", - - "linting", ] include: @@ -87,11 +85,6 @@ os: ubuntu-latest tox_env: "py38-pytest54" - - name: "linting" - python: "3.7" - os: ubuntu-latest - tox_env: "linting" - steps: - uses: actions/checkout@v1 - name: Set up Python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-subtests-0.4.0/CHANGELOG.rst new/pytest-subtests-0.5.0/CHANGELOG.rst --- old/pytest-subtests-0.4.0/CHANGELOG.rst 2020-12-13 14:33:05.000000000 +0100 +++ new/pytest-subtests-0.5.0/CHANGELOG.rst 2021-05-29 15:08:15.000000000 +0200 @@ -1,6 +1,13 @@ CHANGELOG ========= +0.5.0 (2021-05-29) +------------------ + +* Add support for ``pytest.mark.xfail`` (`#40`_). + +.. _#40: https://github.com/pytest-dev/pytest-subtests/pull/40 + 0.4.0 (2020-12-13) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-subtests-0.4.0/HOWTORELEASE.rst new/pytest-subtests-0.5.0/HOWTORELEASE.rst --- old/pytest-subtests-0.4.0/HOWTORELEASE.rst 2020-12-13 14:33:05.000000000 +0100 +++ new/pytest-subtests-0.5.0/HOWTORELEASE.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,37 +0,0 @@ -========================= -Releasing pytest-subtests -========================= - -This document describes the steps to make a new ``pytest-subtests`` release. - -Version -------- - -``master`` should always be green and a potential release candidate. ``pytest-subtests`` follows -semantic versioning, so given that the current version is ``X.Y.Z``, to find the next version number -one needs to look at the ``CHANGELOG.rst`` file: - -- If there any new feature, then we must make a new **minor** release: next - release will be ``X.Y+1.0``. - -- Otherwise it is just a **bug fix** release: ``X.Y.Z+1``. - - -Steps ------ - -To publish a new release ``X.Y.Z``, the steps are as follows: - -#. Create a new branch named ``release-X.Y.Z`` from the latest ``master``. - -#. Update the ``CHANGELOG.rst`` file with the new release information. - -#. Commit and push the branch for review. - -#. Once PR is **green** and **approved**, create and push a tag:: - - $ export VERSION=X.Y.Z - $ git tag v$VERSION release-$VERSION - $ git push g...@github.com:pytest-dev/pytest-subtests.git v$VERSION - -That will build the package and publish it on ``PyPI`` automatically. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-subtests-0.4.0/PKG-INFO new/pytest-subtests-0.5.0/PKG-INFO --- old/pytest-subtests-0.4.0/PKG-INFO 2020-12-13 14:33:19.000000000 +0100 +++ new/pytest-subtests-0.5.0/PKG-INFO 2021-05-29 15:08:20.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: pytest-subtests -Version: 0.4.0 +Version: 0.5.0 Summary: unittest subTest() support and subtests fixture Home-page: https://github.com/pytest-dev/pytest-subtests Author: Bruno Oliveira @@ -8,206 +8,6 @@ Maintainer: Bruno Oliveira Maintainer-email: nicodde...@gmail.com License: MIT -Description: =============== - pytest-subtests - =============== - - unittest ``subTest()`` support and ``subtests`` fixture. - - .. image:: https://img.shields.io/pypi/v/pytest-subtests.svg - :target: https://pypi.org/project/pytest-subtests - :alt: PyPI version - - .. image:: https://img.shields.io/conda/vn/conda-forge/pytest-subtests.svg - :target: https://anaconda.org/conda-forge/pytest-subtests - - .. image:: https://img.shields.io/pypi/pyversions/pytest-subtests.svg - :target: https://pypi.org/project/pytest-subtests - :alt: Python versions - - .. image:: https://github.com/pytest-dev/pytest-subtests/workflows/build/badge.svg - :target: https://github.com/pytest-dev/pytest-subtests/actions - - .. image:: https://img.shields.io/badge/code%20style-black-000000.svg - :target: https://github.com/ambv/black - - ---- - - This `pytest`_ plugin was generated with `Cookiecutter`_ along with `@hackebrot`_'s `cookiecutter-pytest-plugin`_ template. - - - Features - -------- - - * Adds support for `TestCase.subTest <https://docs.python.org/3/library/unittest.html#distinguishing-test-iterations-using-subtests>`__. - - * New ``subtests`` fixture, providing similar functionality for pure pytest tests. - - - Requirements - ------------ - - * ``Python`` >= 3.5. - * ``pytest`` >= 5.3. - - pytest 6.2+ - ^^^^^^^^^^^ - - ``pytest 6.2`` now issues a warning when internal classes are used by third-party code, - which is the case for ``pytest-subtests`` which needs to use some internal classes - to integrate with other pytest features (such as capturing and debugging). - - For now users can ignore those warnings by adding this to their configuration file: - - .. code-block:: ini - - [pytest] - filterwarnings = - ignore:A private pytest class or function was used.:PytestDeprecationWarning - - Installation - ------------ - - You can install ``pytest-subtests`` via `pip`_ from `PyPI`_:: - - $ pip install pytest-subtests - - - - Usage - ----- - - unittest subTest() example - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - - .. code-block:: python - - import unittest - - - class T(unittest.TestCase): - def test_foo(self): - for i in range(5): - with self.subTest("custom message", i=i): - self.assertEqual(i % 2, 0) - - - if __name__ == "__main__": - unittest.main() - - - **Output** - - .. code-block:: - - ?? pytest .tmp\test-unit-subtest.py - ======================== test session starts ======================== - ... - collected 1 item - - .tmp\test-unit-subtest.py FF. [100%] - - ============================= FAILURES ============================== - _________________ T.test_foo [custom message] (i=1) _________________ - - self = <test-unit-subtest.T testMethod=test_foo> - - def test_foo(self): - for i in range(5): - with self.subTest('custom message', i=i): - > self.assertEqual(i % 2, 0) - E AssertionError: 1 != 0 - - .tmp\test-unit-subtest.py:9: AssertionError - _________________ T.test_foo [custom message] (i=3) _________________ - - self = <test-unit-subtest.T testMethod=test_foo> - - def test_foo(self): - for i in range(5): - with self.subTest('custom message', i=i): - > self.assertEqual(i % 2, 0) - E AssertionError: 1 != 0 - - .tmp\test-unit-subtest.py:9: AssertionError - ================ 2 failed, 1 passed in 0.07 seconds ================= - - - ``subtests`` fixture example - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - .. code-block:: python - - def test(subtests): - for i in range(5): - with subtests.test(msg="custom message", i=i): - assert i % 2 == 0 - - - **Output** - - .. code-block:: - - ?? pytest .tmp\test-subtest.py - ======================== test session starts ======================== - ... - collected 1 item - - .tmp\test-subtest.py .F.F.. [100%] - - ============================= FAILURES ============================== - ____________________ test [custom message] (i=1) ____________________ - - def test(subtests): - for i in range(5): - with subtests.test(msg='custom message', i=i): - > assert i % 2 == 0 - E assert (1 % 2) == 0 - - .tmp\test-subtest.py:4: AssertionError - ____________________ test [custom message] (i=3) ____________________ - - def test(subtests): - for i in range(5): - with subtests.test(msg='custom message', i=i): - > assert i % 2 == 0 - E assert (3 % 2) == 0 - - .tmp\test-subtest.py:4: AssertionError - ================ 2 failed, 1 passed in 0.07 seconds ================= - - Contributing - ------------ - Contributions are very welcome. Tests can be run with `tox`_: - - .. code-block:: - - tox -e py37,linting - - License - ------- - - Distributed under the terms of the `MIT`_ license, "pytest-subtests" is free and open source software - - - Issues - ------ - - If you encounter any problems, please `file an issue`_ along with a detailed description. - - .. _`Cookiecutter`: https://github.com/audreyr/cookiecutter - .. _`@hackebrot`: https://github.com/hackebrot - .. _`MIT`: http://opensource.org/licenses/MIT - .. _`BSD-3`: http://opensource.org/licenses/BSD-3-Clause - .. _`GNU GPL v3.0`: http://www.gnu.org/licenses/gpl-3.0.txt - .. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0 - .. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin - .. _`file an issue`: https://github.com/nicoddemus/pytest-subtests/issues - .. _`pytest`: https://github.com/pytest-dev/pytest - .. _`tox`: https://tox.readthedocs.io/en/latest/ - .. _`pip`: https://pypi.org/project/pip/ - .. _`PyPI`: https://pypi.org/project - Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Framework :: Pytest @@ -224,3 +24,206 @@ Classifier: Operating System :: OS Independent Classifier: License :: OSI Approved :: MIT License Requires-Python: >=3.5 +License-File: LICENSE + +=============== +pytest-subtests +=============== + +unittest ``subTest()`` support and ``subtests`` fixture. + +.. image:: https://img.shields.io/pypi/v/pytest-subtests.svg + :target: https://pypi.org/project/pytest-subtests + :alt: PyPI version + +.. image:: https://img.shields.io/conda/vn/conda-forge/pytest-subtests.svg + :target: https://anaconda.org/conda-forge/pytest-subtests + +.. image:: https://img.shields.io/pypi/pyversions/pytest-subtests.svg + :target: https://pypi.org/project/pytest-subtests + :alt: Python versions + +.. image:: https://github.com/pytest-dev/pytest-subtests/workflows/build/badge.svg + :target: https://github.com/pytest-dev/pytest-subtests/actions + +.. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/ambv/black + +---- + +This `pytest`_ plugin was generated with `Cookiecutter`_ along with `@hackebrot`_'s `cookiecutter-pytest-plugin`_ template. + + +Features +-------- + +* Adds support for `TestCase.subTest <https://docs.python.org/3/library/unittest.html#distinguishing-test-iterations-using-subtests>`__. + +* New ``subtests`` fixture, providing similar functionality for pure pytest tests. + + +Requirements +------------ + +* ``Python`` >= 3.5. +* ``pytest`` >= 5.3. + +pytest 6.2+ +^^^^^^^^^^^ + +``pytest 6.2`` now issues a warning when internal classes are used by third-party code, +which is the case for ``pytest-subtests`` which needs to use some internal classes +to integrate with other pytest features (such as capturing and debugging). + +For now users can ignore those warnings by adding this to their configuration file: + +.. code-block:: ini + + [pytest] + filterwarnings = + ignore:A private pytest class or function was used.:PytestDeprecationWarning + +Installation +------------ + +You can install ``pytest-subtests`` via `pip`_ from `PyPI`_:: + + $ pip install pytest-subtests + + + +Usage +----- + +unittest subTest() example +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + import unittest + + + class T(unittest.TestCase): + def test_foo(self): + for i in range(5): + with self.subTest("custom message", i=i): + self.assertEqual(i % 2, 0) + + + if __name__ == "__main__": + unittest.main() + + +**Output** + +.. code-block:: + + ?? pytest .tmp\test-unit-subtest.py + ======================== test session starts ======================== + ... + collected 1 item + + .tmp\test-unit-subtest.py FF. [100%] + + ============================= FAILURES ============================== + _________________ T.test_foo [custom message] (i=1) _________________ + + self = <test-unit-subtest.T testMethod=test_foo> + + def test_foo(self): + for i in range(5): + with self.subTest('custom message', i=i): + > self.assertEqual(i % 2, 0) + E AssertionError: 1 != 0 + + .tmp\test-unit-subtest.py:9: AssertionError + _________________ T.test_foo [custom message] (i=3) _________________ + + self = <test-unit-subtest.T testMethod=test_foo> + + def test_foo(self): + for i in range(5): + with self.subTest('custom message', i=i): + > self.assertEqual(i % 2, 0) + E AssertionError: 1 != 0 + + .tmp\test-unit-subtest.py:9: AssertionError + ================ 2 failed, 1 passed in 0.07 seconds ================= + + +``subtests`` fixture example +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + def test(subtests): + for i in range(5): + with subtests.test(msg="custom message", i=i): + assert i % 2 == 0 + + +**Output** + +.. code-block:: + + ?? pytest .tmp\test-subtest.py + ======================== test session starts ======================== + ... + collected 1 item + + .tmp\test-subtest.py .F.F.. [100%] + + ============================= FAILURES ============================== + ____________________ test [custom message] (i=1) ____________________ + + def test(subtests): + for i in range(5): + with subtests.test(msg='custom message', i=i): + > assert i % 2 == 0 + E assert (1 % 2) == 0 + + .tmp\test-subtest.py:4: AssertionError + ____________________ test [custom message] (i=3) ____________________ + + def test(subtests): + for i in range(5): + with subtests.test(msg='custom message', i=i): + > assert i % 2 == 0 + E assert (3 % 2) == 0 + + .tmp\test-subtest.py:4: AssertionError + ================ 2 failed, 1 passed in 0.07 seconds ================= + +Contributing +------------ +Contributions are very welcome. Tests can be run with `tox`_: + +.. code-block:: + + tox -e py37,linting + +License +------- + +Distributed under the terms of the `MIT`_ license, "pytest-subtests" is free and open source software + + +Issues +------ + +If you encounter any problems, please `file an issue`_ along with a detailed description. + +.. _`Cookiecutter`: https://github.com/audreyr/cookiecutter +.. _`@hackebrot`: https://github.com/hackebrot +.. _`MIT`: http://opensource.org/licenses/MIT +.. _`BSD-3`: http://opensource.org/licenses/BSD-3-Clause +.. _`GNU GPL v3.0`: http://www.gnu.org/licenses/gpl-3.0.txt +.. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0 +.. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin +.. _`file an issue`: https://github.com/pytest-dev/pytest-subtests/issues +.. _`pytest`: https://github.com/pytest-dev/pytest +.. _`tox`: https://tox.readthedocs.io/en/latest/ +.. _`pip`: https://pypi.org/project/pip/ +.. _`PyPI`: https://pypi.org/project + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-subtests-0.4.0/README.rst new/pytest-subtests-0.5.0/README.rst --- old/pytest-subtests-0.4.0/README.rst 2020-12-13 14:33:05.000000000 +0100 +++ new/pytest-subtests-0.5.0/README.rst 2021-05-29 15:08:15.000000000 +0200 @@ -192,7 +192,7 @@ .. _`GNU GPL v3.0`: http://www.gnu.org/licenses/gpl-3.0.txt .. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0 .. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin -.. _`file an issue`: https://github.com/nicoddemus/pytest-subtests/issues +.. _`file an issue`: https://github.com/pytest-dev/pytest-subtests/issues .. _`pytest`: https://github.com/pytest-dev/pytest .. _`tox`: https://tox.readthedocs.io/en/latest/ .. _`pip`: https://pypi.org/project/pip/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-subtests-0.4.0/RELEASING.rst new/pytest-subtests-0.5.0/RELEASING.rst --- old/pytest-subtests-0.4.0/RELEASING.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-subtests-0.5.0/RELEASING.rst 2021-05-29 15:08:15.000000000 +0200 @@ -0,0 +1,37 @@ +========================= +Releasing pytest-subtests +========================= + +This document describes the steps to make a new ``pytest-subtests`` release. + +Version +------- + +``master`` should always be green and a potential release candidate. ``pytest-subtests`` follows +semantic versioning, so given that the current version is ``X.Y.Z``, to find the next version number +one needs to look at the ``CHANGELOG.rst`` file: + +- If there any new feature, then we must make a new **minor** release: next + release will be ``X.Y+1.0``. + +- Otherwise it is just a **bug fix** release: ``X.Y.Z+1``. + + +Steps +----- + +To publish a new release ``X.Y.Z``, the steps are as follows: + +#. Create a new branch named ``release-X.Y.Z`` from the latest ``master``. + +#. Update the ``CHANGELOG.rst`` file with the new release information. + +#. Commit and push the branch for review. + +#. Once PR is **green** and **approved**, create and push a tag:: + + $ export VERSION=X.Y.Z + $ git tag v$VERSION release-$VERSION + $ git push g...@github.com:pytest-dev/pytest-subtests.git v$VERSION + +That will build the package and publish it on ``PyPI`` automatically. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-subtests-0.4.0/pytest_subtests.egg-info/PKG-INFO new/pytest-subtests-0.5.0/pytest_subtests.egg-info/PKG-INFO --- old/pytest-subtests-0.4.0/pytest_subtests.egg-info/PKG-INFO 2020-12-13 14:33:18.000000000 +0100 +++ new/pytest-subtests-0.5.0/pytest_subtests.egg-info/PKG-INFO 2021-05-29 15:08:20.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: pytest-subtests -Version: 0.4.0 +Version: 0.5.0 Summary: unittest subTest() support and subtests fixture Home-page: https://github.com/pytest-dev/pytest-subtests Author: Bruno Oliveira @@ -8,206 +8,6 @@ Maintainer: Bruno Oliveira Maintainer-email: nicodde...@gmail.com License: MIT -Description: =============== - pytest-subtests - =============== - - unittest ``subTest()`` support and ``subtests`` fixture. - - .. image:: https://img.shields.io/pypi/v/pytest-subtests.svg - :target: https://pypi.org/project/pytest-subtests - :alt: PyPI version - - .. image:: https://img.shields.io/conda/vn/conda-forge/pytest-subtests.svg - :target: https://anaconda.org/conda-forge/pytest-subtests - - .. image:: https://img.shields.io/pypi/pyversions/pytest-subtests.svg - :target: https://pypi.org/project/pytest-subtests - :alt: Python versions - - .. image:: https://github.com/pytest-dev/pytest-subtests/workflows/build/badge.svg - :target: https://github.com/pytest-dev/pytest-subtests/actions - - .. image:: https://img.shields.io/badge/code%20style-black-000000.svg - :target: https://github.com/ambv/black - - ---- - - This `pytest`_ plugin was generated with `Cookiecutter`_ along with `@hackebrot`_'s `cookiecutter-pytest-plugin`_ template. - - - Features - -------- - - * Adds support for `TestCase.subTest <https://docs.python.org/3/library/unittest.html#distinguishing-test-iterations-using-subtests>`__. - - * New ``subtests`` fixture, providing similar functionality for pure pytest tests. - - - Requirements - ------------ - - * ``Python`` >= 3.5. - * ``pytest`` >= 5.3. - - pytest 6.2+ - ^^^^^^^^^^^ - - ``pytest 6.2`` now issues a warning when internal classes are used by third-party code, - which is the case for ``pytest-subtests`` which needs to use some internal classes - to integrate with other pytest features (such as capturing and debugging). - - For now users can ignore those warnings by adding this to their configuration file: - - .. code-block:: ini - - [pytest] - filterwarnings = - ignore:A private pytest class or function was used.:PytestDeprecationWarning - - Installation - ------------ - - You can install ``pytest-subtests`` via `pip`_ from `PyPI`_:: - - $ pip install pytest-subtests - - - - Usage - ----- - - unittest subTest() example - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - - .. code-block:: python - - import unittest - - - class T(unittest.TestCase): - def test_foo(self): - for i in range(5): - with self.subTest("custom message", i=i): - self.assertEqual(i % 2, 0) - - - if __name__ == "__main__": - unittest.main() - - - **Output** - - .. code-block:: - - ?? pytest .tmp\test-unit-subtest.py - ======================== test session starts ======================== - ... - collected 1 item - - .tmp\test-unit-subtest.py FF. [100%] - - ============================= FAILURES ============================== - _________________ T.test_foo [custom message] (i=1) _________________ - - self = <test-unit-subtest.T testMethod=test_foo> - - def test_foo(self): - for i in range(5): - with self.subTest('custom message', i=i): - > self.assertEqual(i % 2, 0) - E AssertionError: 1 != 0 - - .tmp\test-unit-subtest.py:9: AssertionError - _________________ T.test_foo [custom message] (i=3) _________________ - - self = <test-unit-subtest.T testMethod=test_foo> - - def test_foo(self): - for i in range(5): - with self.subTest('custom message', i=i): - > self.assertEqual(i % 2, 0) - E AssertionError: 1 != 0 - - .tmp\test-unit-subtest.py:9: AssertionError - ================ 2 failed, 1 passed in 0.07 seconds ================= - - - ``subtests`` fixture example - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - .. code-block:: python - - def test(subtests): - for i in range(5): - with subtests.test(msg="custom message", i=i): - assert i % 2 == 0 - - - **Output** - - .. code-block:: - - ?? pytest .tmp\test-subtest.py - ======================== test session starts ======================== - ... - collected 1 item - - .tmp\test-subtest.py .F.F.. [100%] - - ============================= FAILURES ============================== - ____________________ test [custom message] (i=1) ____________________ - - def test(subtests): - for i in range(5): - with subtests.test(msg='custom message', i=i): - > assert i % 2 == 0 - E assert (1 % 2) == 0 - - .tmp\test-subtest.py:4: AssertionError - ____________________ test [custom message] (i=3) ____________________ - - def test(subtests): - for i in range(5): - with subtests.test(msg='custom message', i=i): - > assert i % 2 == 0 - E assert (3 % 2) == 0 - - .tmp\test-subtest.py:4: AssertionError - ================ 2 failed, 1 passed in 0.07 seconds ================= - - Contributing - ------------ - Contributions are very welcome. Tests can be run with `tox`_: - - .. code-block:: - - tox -e py37,linting - - License - ------- - - Distributed under the terms of the `MIT`_ license, "pytest-subtests" is free and open source software - - - Issues - ------ - - If you encounter any problems, please `file an issue`_ along with a detailed description. - - .. _`Cookiecutter`: https://github.com/audreyr/cookiecutter - .. _`@hackebrot`: https://github.com/hackebrot - .. _`MIT`: http://opensource.org/licenses/MIT - .. _`BSD-3`: http://opensource.org/licenses/BSD-3-Clause - .. _`GNU GPL v3.0`: http://www.gnu.org/licenses/gpl-3.0.txt - .. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0 - .. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin - .. _`file an issue`: https://github.com/nicoddemus/pytest-subtests/issues - .. _`pytest`: https://github.com/pytest-dev/pytest - .. _`tox`: https://tox.readthedocs.io/en/latest/ - .. _`pip`: https://pypi.org/project/pip/ - .. _`PyPI`: https://pypi.org/project - Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Framework :: Pytest @@ -224,3 +24,206 @@ Classifier: Operating System :: OS Independent Classifier: License :: OSI Approved :: MIT License Requires-Python: >=3.5 +License-File: LICENSE + +=============== +pytest-subtests +=============== + +unittest ``subTest()`` support and ``subtests`` fixture. + +.. image:: https://img.shields.io/pypi/v/pytest-subtests.svg + :target: https://pypi.org/project/pytest-subtests + :alt: PyPI version + +.. image:: https://img.shields.io/conda/vn/conda-forge/pytest-subtests.svg + :target: https://anaconda.org/conda-forge/pytest-subtests + +.. image:: https://img.shields.io/pypi/pyversions/pytest-subtests.svg + :target: https://pypi.org/project/pytest-subtests + :alt: Python versions + +.. image:: https://github.com/pytest-dev/pytest-subtests/workflows/build/badge.svg + :target: https://github.com/pytest-dev/pytest-subtests/actions + +.. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/ambv/black + +---- + +This `pytest`_ plugin was generated with `Cookiecutter`_ along with `@hackebrot`_'s `cookiecutter-pytest-plugin`_ template. + + +Features +-------- + +* Adds support for `TestCase.subTest <https://docs.python.org/3/library/unittest.html#distinguishing-test-iterations-using-subtests>`__. + +* New ``subtests`` fixture, providing similar functionality for pure pytest tests. + + +Requirements +------------ + +* ``Python`` >= 3.5. +* ``pytest`` >= 5.3. + +pytest 6.2+ +^^^^^^^^^^^ + +``pytest 6.2`` now issues a warning when internal classes are used by third-party code, +which is the case for ``pytest-subtests`` which needs to use some internal classes +to integrate with other pytest features (such as capturing and debugging). + +For now users can ignore those warnings by adding this to their configuration file: + +.. code-block:: ini + + [pytest] + filterwarnings = + ignore:A private pytest class or function was used.:PytestDeprecationWarning + +Installation +------------ + +You can install ``pytest-subtests`` via `pip`_ from `PyPI`_:: + + $ pip install pytest-subtests + + + +Usage +----- + +unittest subTest() example +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + import unittest + + + class T(unittest.TestCase): + def test_foo(self): + for i in range(5): + with self.subTest("custom message", i=i): + self.assertEqual(i % 2, 0) + + + if __name__ == "__main__": + unittest.main() + + +**Output** + +.. code-block:: + + ?? pytest .tmp\test-unit-subtest.py + ======================== test session starts ======================== + ... + collected 1 item + + .tmp\test-unit-subtest.py FF. [100%] + + ============================= FAILURES ============================== + _________________ T.test_foo [custom message] (i=1) _________________ + + self = <test-unit-subtest.T testMethod=test_foo> + + def test_foo(self): + for i in range(5): + with self.subTest('custom message', i=i): + > self.assertEqual(i % 2, 0) + E AssertionError: 1 != 0 + + .tmp\test-unit-subtest.py:9: AssertionError + _________________ T.test_foo [custom message] (i=3) _________________ + + self = <test-unit-subtest.T testMethod=test_foo> + + def test_foo(self): + for i in range(5): + with self.subTest('custom message', i=i): + > self.assertEqual(i % 2, 0) + E AssertionError: 1 != 0 + + .tmp\test-unit-subtest.py:9: AssertionError + ================ 2 failed, 1 passed in 0.07 seconds ================= + + +``subtests`` fixture example +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + def test(subtests): + for i in range(5): + with subtests.test(msg="custom message", i=i): + assert i % 2 == 0 + + +**Output** + +.. code-block:: + + ?? pytest .tmp\test-subtest.py + ======================== test session starts ======================== + ... + collected 1 item + + .tmp\test-subtest.py .F.F.. [100%] + + ============================= FAILURES ============================== + ____________________ test [custom message] (i=1) ____________________ + + def test(subtests): + for i in range(5): + with subtests.test(msg='custom message', i=i): + > assert i % 2 == 0 + E assert (1 % 2) == 0 + + .tmp\test-subtest.py:4: AssertionError + ____________________ test [custom message] (i=3) ____________________ + + def test(subtests): + for i in range(5): + with subtests.test(msg='custom message', i=i): + > assert i % 2 == 0 + E assert (3 % 2) == 0 + + .tmp\test-subtest.py:4: AssertionError + ================ 2 failed, 1 passed in 0.07 seconds ================= + +Contributing +------------ +Contributions are very welcome. Tests can be run with `tox`_: + +.. code-block:: + + tox -e py37,linting + +License +------- + +Distributed under the terms of the `MIT`_ license, "pytest-subtests" is free and open source software + + +Issues +------ + +If you encounter any problems, please `file an issue`_ along with a detailed description. + +.. _`Cookiecutter`: https://github.com/audreyr/cookiecutter +.. _`@hackebrot`: https://github.com/hackebrot +.. _`MIT`: http://opensource.org/licenses/MIT +.. _`BSD-3`: http://opensource.org/licenses/BSD-3-Clause +.. _`GNU GPL v3.0`: http://www.gnu.org/licenses/gpl-3.0.txt +.. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0 +.. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin +.. _`file an issue`: https://github.com/pytest-dev/pytest-subtests/issues +.. _`pytest`: https://github.com/pytest-dev/pytest +.. _`tox`: https://tox.readthedocs.io/en/latest/ +.. _`pip`: https://pypi.org/project/pip/ +.. _`PyPI`: https://pypi.org/project + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-subtests-0.4.0/pytest_subtests.egg-info/SOURCES.txt new/pytest-subtests-0.5.0/pytest_subtests.egg-info/SOURCES.txt --- old/pytest-subtests-0.4.0/pytest_subtests.egg-info/SOURCES.txt 2020-12-13 14:33:18.000000000 +0100 +++ new/pytest-subtests-0.5.0/pytest_subtests.egg-info/SOURCES.txt 2021-05-29 15:08:20.000000000 +0200 @@ -1,9 +1,9 @@ .gitignore .pre-commit-config.yaml CHANGELOG.rst -HOWTORELEASE.rst LICENSE README.rst +RELEASING.rst pytest_subtests.py setup.py tox.ini diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-subtests-0.4.0/pytest_subtests.py new/pytest-subtests-0.5.0/pytest_subtests.py --- old/pytest-subtests-0.4.0/pytest_subtests.py 2020-12-13 14:33:05.000000000 +0100 +++ new/pytest-subtests-0.5.0/pytest_subtests.py 2021-05-29 15:08:15.000000000 +0200 @@ -71,6 +71,10 @@ ) return report + @classmethod + def _from_test_report(cls, test_report): + return super()._from_json(test_report._to_json()) + def _addSubTest(self, test_case, test, exc_info): if exc_info is not None: @@ -78,7 +82,8 @@ call_info = make_call_info( ExceptionInfo(exc_info), start=0, stop=0, duration=0, when="call" ) - sub_report = SubTestReport.from_item_and_call(item=self, call=call_info) + report = self.ihook.pytest_runtest_makereport(item=self, call=call_info) + sub_report = SubTestReport._from_test_report(report) sub_report.context = SubTestContext(msg, dict(test.params)) self.ihook.pytest_runtest_logreport(report=sub_report) if check_interactive_exception(call_info, sub_report): @@ -171,7 +176,8 @@ call_info = make_call_info( exc_info, start=start, stop=stop, duration=duration, when="call" ) - sub_report = SubTestReport.from_item_and_call(item=self.item, call=call_info) + report = self.ihook.pytest_runtest_makereport(item=self.item, call=call_info) + sub_report = SubTestReport._from_test_report(report) sub_report.context = SubTestContext(msg, kwargs.copy()) captured.update_report(sub_report) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-subtests-0.4.0/tests/test_subtests.py new/pytest-subtests-0.5.0/tests/test_subtests.py --- old/pytest-subtests-0.4.0/tests/test_subtests.py 2020-12-13 14:33:05.000000000 +0100 +++ new/pytest-subtests-0.5.0/tests/test_subtests.py 2021-05-29 15:08:15.000000000 +0200 @@ -103,6 +103,27 @@ expected_lines += ["* 1 passed, 3 skipped in *"] result.stdout.fnmatch_lines(expected_lines) + def test_xfail(self, testdir, mode): + testdir.makepyfile( + """ + import pytest + def test_foo(subtests): + for i in range(5): + with subtests.test(msg="custom", i=i): + if i % 2 == 0: + pytest.xfail('even number') + """ + ) + if mode == "normal": + result = testdir.runpytest() + expected_lines = ["collected 1 item"] + else: + pytest.importorskip("xdist") + result = testdir.runpytest("-n1") + expected_lines = ["gw0 [1]"] + expected_lines += ["* 1 passed, 3 xfailed in *"] + result.stdout.fnmatch_lines(expected_lines) + class TestSubTest: """ @@ -234,6 +255,35 @@ ["collected 1 item", "* 3 skipped, 1 passed in *"] ) + @pytest.mark.parametrize("runner", ["unittest", "pytest-normal", "pytest-xdist"]) + @pytest.mark.xfail(reason="Not producing the expected results (#5)") + def test_xfail(self, testdir, runner): + p = testdir.makepyfile( + """ + import pytest + from unittest import expectedFailure, TestCase, main + + class T(TestCase): + @expectedFailure + def test_foo(self): + for i in range(5): + with self.subTest(msg="custom", i=i): + if i % 2 == 0: + raise pytest.xfail('even number') + + if __name__ == '__main__': + main() + """ + ) + if runner == "unittest": + result = testdir.runpython(p) + result.stderr.fnmatch_lines(["Ran 1 test in *", "OK (expected failures=3)"]) + else: + result = testdir.runpytest(p) + result.stdout.fnmatch_lines( + ["collected 1 item", "* 3 xfailed, 1 passed in *"] + ) + class TestCapture: def create_file(self, testdir): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-subtests-0.4.0/tox.ini new/pytest-subtests-0.5.0/tox.ini --- old/pytest-subtests-0.4.0/tox.ini 2020-12-13 14:33:05.000000000 +0100 +++ new/pytest-subtests-0.5.0/tox.ini 2021-05-29 15:08:15.000000000 +0200 @@ -11,13 +11,5 @@ commands = pytest {posargs:tests} -[testenv:linting] -skip_install = True -basepython = python3 -deps = - pre-commit>=1.11.0 -commands = - pre-commit run --all-files --show-diff-on-failure - [flake8] max-line-length = 120