Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pytest-plus for openSUSE:Factory checked in at 2023-11-08 22:17:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-plus (Old) and /work/SRC/openSUSE:Factory/.python-pytest-plus.new.17445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-plus" Wed Nov 8 22:17:51 2023 rev:3 rq:1124090 version:0.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-plus/python-pytest-plus.changes 2023-05-10 16:20:06.255535406 +0200 +++ /work/SRC/openSUSE:Factory/.python-pytest-plus.new.17445/python-pytest-plus.changes 2023-11-08 22:18:19.844501952 +0100 @@ -1,0 +2,10 @@ +Tue Nov 7 19:56:48 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 0.6.0: + * Add checks for test id length and content + * Allow _, - and . in test id + * Prevent duplicate test names + * Enable mypy + * Replace flake8 with ruff + +------------------------------------------------------------------- Old: ---- pytest-plus-0.4.0.tar.gz New: ---- pytest-plus-0.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-plus.spec ++++++ --- /var/tmp/diff_new_pack.vazP6Q/_old 2023-11-08 22:18:20.568528551 +0100 +++ /var/tmp/diff_new_pack.vazP6Q/_new 2023-11-08 22:18:20.572528698 +0100 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-pytest-plus -Version: 0.4.0 +Version: 0.6.0 Release: 0 Summary: Extension for pytest to enforce minimum tests pass License: MIT ++++++ pytest-plus-0.4.0.tar.gz -> pytest-plus-0.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/.github/workflows/tox.yml new/pytest-plus-0.6.0/.github/workflows/tox.yml --- old/pytest-plus-0.4.0/.github/workflows/tox.yml 2022-12-24 11:27:01.000000000 +0100 +++ new/pytest-plus-0.6.0/.github/workflows/tox.yml 2023-10-18 16:16:30.000000000 +0200 @@ -1,9 +1,7 @@ --- name: tox + on: - create: # is used for publishing to PyPI and TestPyPI - tags: # any tag regardless of its name, no branches - - "**" push: # only publishes pushes to the main branch to TestPyPI branches: # any integration branch but not tag - "main" @@ -20,45 +18,49 @@ PY_COLORS: 1 jobs: - pre: - name: pre + prepare: + name: prepare runs-on: ubuntu-22.04 outputs: matrix: ${{ steps.generate_matrix.outputs.matrix }} steps: - name: Determine matrix id: generate_matrix - uses: coactions/matrix@main + uses: coactions/dynamic-matrix@v1 with: min_python: "3.9" + max_python: "3.12" other_names: | lint pkg devel build: - name: ${{ matrix.name || matrix.passed_name || '?' }} - needs: pre + name: ${{ matrix.name }} + environment: test runs-on: ${{ matrix.os || 'ubuntu-22.04' }} + needs: + - prepare defaults: run: shell: ${{ matrix.shell || 'bash'}} strategy: fail-fast: false - matrix: ${{ fromJson(needs.pre.outputs.matrix) }} + matrix: ${{ fromJson(needs.prepare.outputs.matrix) }} env: - PYTEST_REQPASS: 1 + PYTEST_REQPASS: 4 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # needed by setuptools-scm - - name: Set caches - if: "${{ contains(matrix.passed_name, 'lint') }}" + - name: Set pre-commit cache uses: actions/cache@v3 + if: ${{ matrix.passed_name == 'lint' }} with: - path: ~/.cache/pre-commit - key: ${{ matrix.name || matrix.passed_name }}-${{ hashFiles('.pre-commit-config.yaml') }} + path: | + ~/.cache/pre-commit + key: pre-commit-${{ matrix.name || matrix.passed_name }}-${{ hashFiles('.pre-commit-config.yaml') }} - name: Set up Python ${{ matrix.python_version || '3.9' }} uses: actions/setup-python@v4 @@ -74,7 +76,7 @@ - name: Log installed dists run: python3 -m pip freeze --all - - name: Initialize tox envs ${{ matrix.passed_env }} + - name: Initialize tox envs ${{ matrix.passed_name }} run: python3 -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.passed_name }} timeout-minutes: 5 # average is under 1, but macos can be over 3 @@ -131,7 +133,7 @@ jobs: ${{ toJSON(needs) }} - name: Check out src from Git - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Notify repository owners about lint change affecting them uses: sourcegraph/codenotify@v0.6.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/.pre-commit-config.yaml new/pytest-plus-0.6.0/.pre-commit-config.yaml --- old/pytest-plus-0.4.0/.pre-commit-config.yaml 2022-12-24 11:27:01.000000000 +0100 +++ new/pytest-plus-0.6.0/.pre-commit-config.yaml 2023-10-18 16:16:30.000000000 +0200 @@ -8,7 +8,7 @@ - id: check-useless-excludes - repo: https://github.com/pre-commit/mirrors-prettier # keep it before yamllint - rev: v3.0.0-alpha.4 + rev: v3.0.3 hooks: - id: prettier always_run: true @@ -17,16 +17,16 @@ - prettier-plugin-toml - prettier-plugin-sort-json - repo: https://github.com/PyCQA/doc8.git - rev: v1.1.0 + rev: v1.1.1 hooks: - id: doc8 - repo: https://github.com/python/black - rev: 22.12.0 + rev: 23.9.1 hooks: - id: black language_version: python3 - repo: https://github.com/pre-commit/pre-commit-hooks.git - rev: v4.4.0 + rev: v4.5.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace @@ -35,21 +35,28 @@ - id: check-executables-have-shebangs - id: check-merge-conflict - id: debug-statements - - repo: https://github.com/pycqa/flake8.git - rev: 6.0.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.1.0" hooks: - - id: flake8 + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.6.0 + hooks: + - id: mypy + # empty args needed in order to match mypy cli behavior + args: [--strict] additional_dependencies: - - flake8-black + - pytest - repo: https://github.com/adrienverge/yamllint.git - rev: v1.28.0 + rev: v1.32.0 hooks: - id: yamllint files: \.(yaml|yml)$ types: [file, yaml] entry: yamllint --strict - repo: https://github.com/codespell-project/codespell.git - rev: v2.2.2 + rev: v2.2.6 hooks: - id: codespell name: codespell @@ -61,10 +68,10 @@ require_serial: false additional_dependencies: [] - repo: https://github.com/jazzband/pip-tools - rev: 6.12.1 + rev: 7.3.0 hooks: - id: pip-compile - entry: pip-compile --resolver=backtracking -q --no-annotate --output-file=requirements.txt pyproject.toml --extra test --strip-extras + entry: pip-compile -q --no-annotate --output-file=requirements.txt pyproject.toml --extra test --strip-extras language: python files: ^(requirements\.txt|pyproject\.toml)$ alias: deps @@ -72,7 +79,7 @@ additional_dependencies: - pip>=22.3.1 - id: pip-compile - entry: pip-compile --resolver=backtracking -q --no-annotate --output-file=requirements.txt pyproject.toml --extra test --strip-extras --upgrade + entry: pip-compile -q --no-annotate --output-file=requirements.txt pyproject.toml --extra test --strip-extras --upgrade language: python files: ^(requirements\.txt|pyproject\.toml)$ alias: up diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/PKG-INFO new/pytest-plus-0.6.0/PKG-INFO --- old/pytest-plus-0.4.0/PKG-INFO 2022-12-24 11:27:15.366645800 +0100 +++ new/pytest-plus-0.6.0/PKG-INFO 2023-10-18 16:16:49.448193800 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pytest-plus -Version: 0.4.0 +Version: 0.6.0 Summary: PyTest Plus Plugin :: extends pytest functionality Author-email: Sorin Sbarnea <sorin.sbar...@gmail.com> Maintainer-email: Sorin Sbarnea <sorin.sbar...@gmail.com> @@ -31,8 +31,11 @@ Classifier: Topic :: Utilities Requires-Python: >=3.9 Description-Content-Type: text/markdown -Provides-Extra: test License-File: LICENSE +Requires-Dist: pytest>=7.4.2 +Provides-Extra: test +Requires-Dist: coverage>=7.0.0; extra == "test" +Requires-Dist: pytest-html; extra == "test" # PyTest Plus Plugin :: extends pytest functionality @@ -62,6 +65,32 @@ developer runs tests, they are likely to endup running a different number of tests. Also, this feature makes no sense if you try to mention a specific test. +## Avoiding duplicate test function names + +While pytest allows users to have the same test function names in different +files, that makes it harder to identify and copy/paste the test name in order +to reproduce the failure locally. That is why this plugin forces its users to +avoid having the same function name anywhere in the tested project. + +You can disable this check by defining `PYTEST_CHECK_TEST_DUPLICATE=0`. + +## Avoiding problematic test identifiers + +This plugin will raise errors when it encounters test IDs that are either too +long or that contain unsafe characters. While pytest is very flexible in allowing +a wide range of test IDs, using these does make development harder as it prevents +people from doing a copy/paste with failed test and pasting in in their terminal +to reproduce the failed test locally. + +You can disable regex check by defining `PYTEST_CHECK_TEST_ID_REGEX=0`. + +You can disable the length check by defining `PYTEST_MAX_TEST_ID_LENGTH=0`. + +## Release process + +Releases are triggered from [GitHub Releases](https://github.com/pytest-dev/pytest-plus/releases) +page. + ## Links - [MIT](http://opensource.org/licenses/MIT) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/README.md new/pytest-plus-0.6.0/README.md --- old/pytest-plus-0.4.0/README.md 2022-12-24 11:27:01.000000000 +0100 +++ new/pytest-plus-0.6.0/README.md 2023-10-18 16:16:30.000000000 +0200 @@ -26,6 +26,32 @@ developer runs tests, they are likely to endup running a different number of tests. Also, this feature makes no sense if you try to mention a specific test. +## Avoiding duplicate test function names + +While pytest allows users to have the same test function names in different +files, that makes it harder to identify and copy/paste the test name in order +to reproduce the failure locally. That is why this plugin forces its users to +avoid having the same function name anywhere in the tested project. + +You can disable this check by defining `PYTEST_CHECK_TEST_DUPLICATE=0`. + +## Avoiding problematic test identifiers + +This plugin will raise errors when it encounters test IDs that are either too +long or that contain unsafe characters. While pytest is very flexible in allowing +a wide range of test IDs, using these does make development harder as it prevents +people from doing a copy/paste with failed test and pasting in in their terminal +to reproduce the failed test locally. + +You can disable regex check by defining `PYTEST_CHECK_TEST_ID_REGEX=0`. + +You can disable the length check by defining `PYTEST_MAX_TEST_ID_LENGTH=0`. + +## Release process + +Releases are triggered from [GitHub Releases](https://github.com/pytest-dev/pytest-plus/releases) +page. + ## Links - [MIT](http://opensource.org/licenses/MIT) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/codecov.yml new/pytest-plus-0.6.0/codecov.yml --- old/pytest-plus-0.4.0/codecov.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-plus-0.6.0/codecov.yml 2023-10-18 16:16:30.000000000 +0200 @@ -0,0 +1,5 @@ +--- +comment: false +coverage: + status: + patch: false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/pyproject.toml new/pytest-plus-0.6.0/pyproject.toml --- old/pytest-plus-0.4.0/pyproject.toml 2022-12-24 11:27:01.000000000 +0100 +++ new/pytest-plus-0.6.0/pyproject.toml 2023-10-18 16:16:30.000000000 +0200 @@ -41,7 +41,7 @@ "Topic :: Utilities", ] keywords = ["testing", "pytest", "plugin"] -dependencies = ["pytest>=6.0.1"] +dependencies = ["pytest>=7.4.2"] [project.urls] homepage = "https://github.com/pytest-dev/pytest-plus" @@ -54,9 +54,36 @@ [project.entry-points.pytest11] plus = "pytest_plus" +[tool.coverage.run] +omit = ["test/*", "/private/var/folders/*", "/tmp/*"] + +[tool.coverage.report] +fail_under = 100 +omit = ["test/*", "/private/var/folders/*", "/tmp/*"] +show_missing = true + [tool.pytest.ini_options] addopts = "-p no:flaky" +filterwarnings = [ + "error", + "ignore:ast.(Str|Num|NameConstant) is deprecated and will be removed in Python 3.14:DeprecationWarning:_pytest.assertion.rewrite", + "ignore:Attribute s is deprecated and will be removed in Python 3.14:DeprecationWarning:_pytest.assertion.rewrite", +] + +[tool.ruff] +ignore = [ + "D203", # incompatible with D211 + "D213", # incompatible with D212 + "E501", # we use black +] +select = ["ALL"] +target-version = "py39" +# Same as Black. +line-length = 88 + +[tool.ruff.per-file-ignores] +"test/**/*.py" = ["S"] [tool.setuptools_scm] local_scheme = "no-local-version" write_to = "src/pytest_plus/_version.py" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/requirements.txt new/pytest-plus-0.6.0/requirements.txt --- old/pytest-plus-0.4.0/requirements.txt 2022-12-24 11:27:01.000000000 +0100 +++ new/pytest-plus-0.6.0/requirements.txt 2023-10-18 16:16:30.000000000 +0200 @@ -2,16 +2,16 @@ # This file is autogenerated by pip-compile with Python 3.9 # by the following command: # -# pip-compile --extra=test --no-annotate --output-file=requirements.txt --resolver=backtracking --strip-extras pyproject.toml +# pip-compile --extra=test --no-annotate --output-file=requirements.txt --strip-extras pyproject.toml # -attrs==22.1.0 -coverage==7.0.0 -exceptiongroup==1.0.4 -iniconfig==1.1.1 -packaging==22.0 -pluggy==1.0.0 -py==1.11.0 -pytest==7.2.0 -pytest-html==3.2.0 -pytest-metadata==2.0.4 +coverage==7.3.2 +exceptiongroup==1.1.3 +iniconfig==2.0.0 +jinja2==3.1.2 +markupsafe==2.1.3 +packaging==23.2 +pluggy==1.3.0 +pytest==7.4.2 +pytest-html==4.0.2 +pytest-metadata==3.0.0 tomli==2.0.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/src/pytest_plus/__init__.py new/pytest-plus-0.6.0/src/pytest_plus/__init__.py --- old/pytest-plus-0.4.0/src/pytest_plus/__init__.py 2022-12-24 11:27:01.000000000 +0100 +++ new/pytest-plus-0.6.0/src/pytest_plus/__init__.py 2023-10-18 16:16:30.000000000 +0200 @@ -1,31 +1,78 @@ """PyTest Config File.""" +from __future__ import annotations -from __future__ import print_function import os +import re + import pytest -import sys +from _pytest.terminal import TerminalReporter + +PYTEST_CHECK_TEST_DUPLICATE = int(os.environ.get("PYTEST_CHECK_TEST_DUPLICATE", "1")) + + +def get_max_test_id_length() -> int: + """Return max test id length.""" + return int(os.environ.get("PYTEST_MAX_TEST_ID_LENGTH", "60")) + + +def get_test_id_regex() -> None | re.Pattern[str]: + """Return regex to use for checking test ids.""" + if int(os.environ.get("PYTEST_CHECK_TEST_ID_REGEX", "1")): + return re.compile(r"^[\w_\-\.]+$") + return None -@pytest.hookimpl(hookwrapper=True) -def pytest_terminal_summary(terminalreporter, exitstatus, config): +def pytest_sessionfinish(session: pytest.Session) -> None: """Assure passed test match PYTEST_REQPASS value. Assures that pytest returns an error code when the number of expected passed tests does not match the PYTEST_REQPASS value. When not defined or zero that functionality is ignored. """ - yield + terminalreporter = session.config.pluginmanager.get_plugin("terminalreporter") + if not isinstance(terminalreporter, TerminalReporter): + raise TypeError # pragma: no cover req_passed = int(os.environ.get("PYTEST_REQPASS", "0")) - if req_passed and not config.option.collectonly: + if req_passed and not session.config.option.collectonly: passed = 0 for x in terminalreporter.stats.get("passed", []): if x.when == "call" and x.outcome == "passed": passed += 1 if passed != req_passed: terminalreporter.write_line( - "ERROR: {} passed test but expected number was {}. " - " If that is expected please update PYTEST_REQPASS value for the failed job in zuul.d/layout.yaml file.".format( - passed, req_passed - ) + f"ERROR: {passed} passed test but expected number was {req_passed}. " + " If that is expected please update PYTEST_REQPASS value for the failed job.", ) - sys.exit(1) + session.exitstatus = 1 + + +@pytest.hookimpl(tryfirst=True) # type: ignore[misc,unused-ignore] +def pytest_collection_modifyitems(items: list[pytest.Item]) -> None: + """Ensure testing fails if tests have duplicate names.""" + errors = [] + names = {} + max_test_id_length = get_max_test_id_length() + test_id_regex = get_test_id_regex() + for item in items: + base_name = item.name.split("[")[0] + if base_name not in names: + names[base_name] = item.location + elif item.location[:2] != names[base_name][:2] and PYTEST_CHECK_TEST_DUPLICATE: + error = f"Duplicate test name '{base_name}', found at {item.location[0]}:{item.location[1]} and {names[base_name][0]}:{names[base_name][1]}" + if error not in errors: + errors.append(error) + if hasattr(item, "callspec"): + test_id = item.callspec.id + if max_test_id_length and len(test_id) > max_test_id_length: + errors.append( + f"{item} has an id that looks above {max_test_id_length} characters.", + ) + elif test_id_regex and not test_id_regex.match(test_id): + errors.append( + f"Test {item} has an id that does not match our safe pattern '{test_id_regex.pattern}' for use with a terminal.", + ) + if errors: + msg = f"Failed run due to following issues being identified:\n{os.linesep.join(errors)}" + raise pytest.UsageError( + msg, + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/src/pytest_plus/_version.py new/pytest-plus-0.6.0/src/pytest_plus/_version.py --- old/pytest-plus-0.4.0/src/pytest_plus/_version.py 2022-12-24 11:27:15.000000000 +0100 +++ new/pytest-plus-0.6.0/src/pytest_plus/_version.py 2023-10-18 16:16:49.000000000 +0200 @@ -1,4 +1,16 @@ # file generated by setuptools_scm # don't change, don't track in version control -__version__ = version = '0.4.0' -__version_tuple__ = version_tuple = (0, 4, 0) +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple, Union + VERSION_TUPLE = Tuple[Union[int, str], ...] +else: + VERSION_TUPLE = object + +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE + +__version__ = version = '0.6.0' +__version_tuple__ = version_tuple = (0, 6, 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/src/pytest_plus.egg-info/PKG-INFO new/pytest-plus-0.6.0/src/pytest_plus.egg-info/PKG-INFO --- old/pytest-plus-0.4.0/src/pytest_plus.egg-info/PKG-INFO 2022-12-24 11:27:15.000000000 +0100 +++ new/pytest-plus-0.6.0/src/pytest_plus.egg-info/PKG-INFO 2023-10-18 16:16:49.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pytest-plus -Version: 0.4.0 +Version: 0.6.0 Summary: PyTest Plus Plugin :: extends pytest functionality Author-email: Sorin Sbarnea <sorin.sbar...@gmail.com> Maintainer-email: Sorin Sbarnea <sorin.sbar...@gmail.com> @@ -31,8 +31,11 @@ Classifier: Topic :: Utilities Requires-Python: >=3.9 Description-Content-Type: text/markdown -Provides-Extra: test License-File: LICENSE +Requires-Dist: pytest>=7.4.2 +Provides-Extra: test +Requires-Dist: coverage>=7.0.0; extra == "test" +Requires-Dist: pytest-html; extra == "test" # PyTest Plus Plugin :: extends pytest functionality @@ -62,6 +65,32 @@ developer runs tests, they are likely to endup running a different number of tests. Also, this feature makes no sense if you try to mention a specific test. +## Avoiding duplicate test function names + +While pytest allows users to have the same test function names in different +files, that makes it harder to identify and copy/paste the test name in order +to reproduce the failure locally. That is why this plugin forces its users to +avoid having the same function name anywhere in the tested project. + +You can disable this check by defining `PYTEST_CHECK_TEST_DUPLICATE=0`. + +## Avoiding problematic test identifiers + +This plugin will raise errors when it encounters test IDs that are either too +long or that contain unsafe characters. While pytest is very flexible in allowing +a wide range of test IDs, using these does make development harder as it prevents +people from doing a copy/paste with failed test and pasting in in their terminal +to reproduce the failed test locally. + +You can disable regex check by defining `PYTEST_CHECK_TEST_ID_REGEX=0`. + +You can disable the length check by defining `PYTEST_MAX_TEST_ID_LENGTH=0`. + +## Release process + +Releases are triggered from [GitHub Releases](https://github.com/pytest-dev/pytest-plus/releases) +page. + ## Links - [MIT](http://opensource.org/licenses/MIT) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/src/pytest_plus.egg-info/SOURCES.txt new/pytest-plus-0.6.0/src/pytest_plus.egg-info/SOURCES.txt --- old/pytest-plus-0.4.0/src/pytest_plus.egg-info/SOURCES.txt 2022-12-24 11:27:15.000000000 +0100 +++ new/pytest-plus-0.6.0/src/pytest_plus.egg-info/SOURCES.txt 2023-10-18 16:16:49.000000000 +0200 @@ -4,6 +4,7 @@ .yamllint LICENSE README.md +codecov.yml pyproject.toml requirements.txt tox.ini @@ -16,10 +17,12 @@ .github/workflows/tox.yml src/pytest_plus/__init__.py src/pytest_plus/_version.py +src/pytest_plus/py.typed src/pytest_plus.egg-info/PKG-INFO src/pytest_plus.egg-info/SOURCES.txt src/pytest_plus.egg-info/dependency_links.txt src/pytest_plus.egg-info/entry_points.txt src/pytest_plus.egg-info/requires.txt src/pytest_plus.egg-info/top_level.txt -tests/test_plugin.py \ No newline at end of file +test/__init__.py +test/test_plugin.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/src/pytest_plus.egg-info/requires.txt new/pytest-plus-0.6.0/src/pytest_plus.egg-info/requires.txt --- old/pytest-plus-0.4.0/src/pytest_plus.egg-info/requires.txt 2022-12-24 11:27:15.000000000 +0100 +++ new/pytest-plus-0.6.0/src/pytest_plus.egg-info/requires.txt 2023-10-18 16:16:49.000000000 +0200 @@ -1,4 +1,4 @@ -pytest>=6.0.1 +pytest>=7.4.2 [test] coverage>=7.0.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/test/__init__.py new/pytest-plus-0.6.0/test/__init__.py --- old/pytest-plus-0.4.0/test/__init__.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-plus-0.6.0/test/__init__.py 2023-10-18 16:16:30.000000000 +0200 @@ -0,0 +1 @@ +"""Tests for pytest-plus.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/test/test_plugin.py new/pytest-plus-0.6.0/test/test_plugin.py --- old/pytest-plus-0.4.0/test/test_plugin.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-plus-0.6.0/test/test_plugin.py 2023-10-18 16:16:30.000000000 +0200 @@ -0,0 +1,89 @@ +"""Tests.""" +import os + +import pytest + +pytest_plugins = ["pytester"] + + +def test_duplicate_test_name(pytester: pytest.Pytester) -> None: + """Validates that we can detect duplicate test names.""" + p1 = pytester.makepyfile( + test_one=""" + def test_a(): + assert True + """, + ) + p2 = pytester.makepyfile( + test_two=""" + def test_a(): + assert True + """, + ) + + result = pytester.runpytest_inprocess(p1, p2) + assert ( + result.errlines[0] + == "ERROR: Failed run due to following issues being identified:" + ) + assert ( + result.errlines[1] + == "Duplicate test name 'test_a', found at test_two.py:0 and test_one.py:0" + ) + assert result.ret == pytest.ExitCode.USAGE_ERROR + + +@pytest.mark.parametrize( + ("rc", "disable"), + [ + pytest.param(pytest.ExitCode.USAGE_ERROR, False, id="0"), + pytest.param(pytest.ExitCode.OK, True, id="1"), + ], +) +def test_check_test_id(pytester: pytest.Pytester, rc: int, *, disable: bool) -> None: + """Validates that we can detect duplicate test names.""" + if disable: + os.environ["PYTEST_CHECK_TEST_ID_REGEX"] = "0" + p1 = pytester.makepyfile( + test_one=""" + import pytest + + @pytest.mark.parametrize( + "some", + (pytest.param("", id="invalid name"),), + ) + def test_a(some: str): + assert True + """, + ) + + result = pytester.runpytest_inprocess("--collect-only", p1) + if not disable: + assert ( + "Test <Function test_a[invalid name]> has an id that does not match our safe pattern '^[\\w_\\-\\.]+$' for use with a terminal." + in result.stderr.lines + ) + assert result.ret == rc + + +def test_check_test_id_length(pytester: pytest.Pytester) -> None: + """Validates that we can detect duplicate test names.""" + p1 = pytester.makepyfile( + test_one=""" + import pytest + + @pytest.mark.parametrize( + "some", + (pytest.param("", id="this-is-too-long-for-our-taste-so-we-ask-you-to-make-it-shorter"),), + ) + def test_a(some: str): + assert True + """, + ) + + result = pytester.runpytest_inprocess("--collect-only", p1) + assert ( + "<Function test_a[this-is-too-long-for-our-taste-so-we-ask-you-to-make-it-shorter]> has an id that looks above 60 characters." + in result.stderr.lines + ) + assert result.ret == pytest.ExitCode.USAGE_ERROR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/tests/test_plugin.py new/pytest-plus-0.6.0/tests/test_plugin.py --- old/pytest-plus-0.4.0/tests/test_plugin.py 2022-12-24 11:27:01.000000000 +0100 +++ new/pytest-plus-0.6.0/tests/test_plugin.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -def test_one(): - pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-plus-0.4.0/tox.ini new/pytest-plus-0.6.0/tox.ini --- old/pytest-plus-0.4.0/tox.ini 2022-12-24 11:27:01.000000000 +0100 +++ new/pytest-plus-0.6.0/tox.ini 2023-10-18 16:16:30.000000000 +0200 @@ -1,6 +1,6 @@ # For more information about tox, see https://tox.readthedocs.io/en/latest/ [tox] -minversion = 4.0 +minversion = 4.6.3 envlist = lint py @@ -13,18 +13,24 @@ description = Unit testing usedevelop = True +commands_pre = + sh -c "rm -f .tox/.coverage.* 2>/dev/null || true" commands = pytest --collect-only # Do not use PYTEST_REQPASS as here, read README.md for details - sh -c "PYTEST_REQPASS=1 coverage run -m pytest --color=yes --html={envlogdir}/reports.html --self-contained-html {tty:-s}" + sh -c "PYTEST_REQPASS=4 coverage run -m pytest --color=yes --html={envlogdir}/reports.html --self-contained-html {tty:-s}" # We want to fail if result code is zero: sh -c "PYTEST_REQPASS=100 pytest >/dev/null && exit 1 || true" + sh -c "coverage combine -a -q --data-file=.coverage .tox/.coverage.*" + sh -c "COVERAGE_FILE=.coverage python3 -m coverage report" deps = -e .[test] devel: git+https://github.com/pytest-dev/pytest.git extras = test setenv = + COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}} + COVERAGE_PROCESS_START={toxinidir}/pyproject.toml PIP_DISABLE_PIP_VERSION_CHECK=1 PRE_COMMIT_COLOR=always PY_COLORS={env:PY_COLORS:1} @@ -85,3 +91,19 @@ pre-commit autoupdate # We fail if files are modified at the end git diff --exit-code + +[testenv:coverage] +description = Combines and displays coverage results +skip_install = true +usedevelop = false +setenv = + COVERAGE_PROCESS_START={toxinidir}/pyproject.toml +commands_pre = +commands = + python3 -m coverage --version + # needed by codecov github actions, also ignored result to reach report one. + python3 -m coverage xml --fail-under=0 + # just for humans running it: + python3 -m coverage report +deps = + coverage[toml]>=7.0.5