Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-cfgv for openSUSE:Factory checked in at 2023-09-20 13:29:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cfgv (Old) and /work/SRC/openSUSE:Factory/.python-cfgv.new.16627 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-cfgv" Wed Sep 20 13:29:11 2023 rev:7 rq:1112161 version:3.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cfgv/python-cfgv.changes 2022-03-28 17:01:44.149065120 +0200 +++ /work/SRC/openSUSE:Factory/.python-cfgv.new.16627/python-cfgv.changes 2023-09-20 13:31:53.132440418 +0200 @@ -1,0 +2,7 @@ +Tue Sep 12 07:06:50 UTC 2023 - Dirk Müller <[email protected]> + +- update to 3.4.0: + * add a custom display name for loading from file + * require python 3.8 + +------------------------------------------------------------------- Old: ---- cfgv-3.3.1.tar.gz New: ---- cfgv-3.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cfgv.spec ++++++ --- /var/tmp/diff_new_pack.6V0kp6/_old 2023-09-20 13:31:54.276481405 +0200 +++ /var/tmp/diff_new_pack.6V0kp6/_new 2023-09-20 13:31:54.276481405 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-cfgv # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,16 +16,17 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} -%define skip_python2 1 +%{?sle15_python_module_pythons} Name: python-cfgv -Version: 3.3.1 +Version: 3.4.0 Release: 0 Summary: Configuration validator producing human readable error messages License: MIT URL: https://github.com/asottile/cfgv Source: https://github.com/asottile/cfgv/archive/v%{version}.tar.gz#/cfgv-%{version}.tar.gz -BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module devel >= 3.8} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch @@ -41,10 +42,10 @@ %setup -q -n cfgv-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check ++++++ cfgv-3.3.1.tar.gz -> cfgv-3.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-3.3.1/.github/FUNDING.yml new/cfgv-3.4.0/.github/FUNDING.yml --- old/cfgv-3.3.1/.github/FUNDING.yml 2021-08-25 16:18:18.000000000 +0200 +++ new/cfgv-3.4.0/.github/FUNDING.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -github: asottile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-3.3.1/.github/workflows/main.yml new/cfgv-3.4.0/.github/workflows/main.yml --- old/cfgv-3.3.1/.github/workflows/main.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/cfgv-3.4.0/.github/workflows/main.yml 2023-08-12 22:38:08.000000000 +0200 @@ -0,0 +1,13 @@ +name: main + +on: + push: + branches: [main, test-me-*] + tags: '*' + pull_request: + +jobs: + main: + uses: asottile/workflows/.github/workflows/[email protected] + with: + env: '["py38", "py39", "py310", "py311"]' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-3.3.1/.gitignore new/cfgv-3.4.0/.gitignore --- old/cfgv-3.3.1/.gitignore 2021-08-25 16:18:18.000000000 +0200 +++ new/cfgv-3.4.0/.gitignore 2023-08-12 22:38:08.000000000 +0200 @@ -1,6 +1,4 @@ *.egg-info *.pyc -/.pytest_cache /.coverage /.tox -/venv* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-3.3.1/.pre-commit-config.yaml new/cfgv-3.4.0/.pre-commit-config.yaml --- old/cfgv-3.3.1/.pre-commit-config.yaml 2021-08-25 16:18:18.000000000 +0200 +++ new/cfgv-3.4.0/.pre-commit-config.yaml 2023-08-12 22:38:08.000000000 +0200 @@ -1,38 +1,37 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.4.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - - id: check-docstring-first - id: check-yaml - id: debug-statements + - id: double-quote-string-fixer - id: name-tests-test - id: requirements-txt-fixer -- repo: https://github.com/PyCQA/flake8 - rev: 3.9.2 - hooks: - - id: flake8 -- repo: https://github.com/pre-commit/mirrors-autopep8 - rev: v1.5.7 +- repo: https://github.com/asottile/setup-cfg-fmt + rev: v2.4.0 hooks: - - id: autopep8 -- repo: https://github.com/asottile/reorder_python_imports - rev: v2.6.0 + - id: setup-cfg-fmt +- repo: https://github.com/asottile/reorder-python-imports + rev: v3.10.0 hooks: - id: reorder-python-imports - args: [--py3-plus] + args: [--py38-plus, --add-import, 'from __future__ import annotations'] +- repo: https://github.com/asottile/add-trailing-comma + rev: v3.0.1 + hooks: + - id: add-trailing-comma - repo: https://github.com/asottile/pyupgrade - rev: v2.24.0 + rev: v3.10.1 hooks: - id: pyupgrade - args: [--py36-plus] -- repo: https://github.com/asottile/add-trailing-comma - rev: v2.1.0 + args: [--py38-plus] +- repo: https://github.com/pre-commit/mirrors-autopep8 + rev: v2.0.2 hooks: - - id: add-trailing-comma - args: [--py36-plus] -- repo: https://github.com/asottile/setup-cfg-fmt - rev: v1.17.0 + - id: autopep8 +- repo: https://github.com/PyCQA/flake8 + rev: 6.1.0 hooks: - - id: setup-cfg-fmt + - id: flake8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-3.3.1/README.md new/cfgv-3.4.0/README.md --- old/cfgv-3.3.1/README.md 2021-08-25 16:18:18.000000000 +0200 +++ new/cfgv-3.4.0/README.md 2023-08-12 22:38:08.000000000 +0200 @@ -1,6 +1,5 @@ -[](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=24&branchName=master) -[](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=24&branchName=master) -[](https://results.pre-commit.ci/latest/github/asottile/cfgv/master) +[](https://github.com/asottile/cfgv/actions/workflows/main.yml) +[](https://results.pre-commit.ci/latest/github/asottile/cfgv/main) cfgv ==== @@ -9,7 +8,9 @@ ## Installation -`pip install cfgv` +```bash +pip install cfgv +``` ## Sample error messages diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-3.3.1/azure-pipelines.yml new/cfgv-3.4.0/azure-pipelines.yml --- old/cfgv-3.3.1/azure-pipelines.yml 2021-08-25 16:18:18.000000000 +0200 +++ new/cfgv-3.4.0/azure-pipelines.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,19 +0,0 @@ -trigger: - branches: - include: [master, test-me-*] - tags: - include: ['*'] - -resources: - repositories: - - repository: asottile - type: github - endpoint: github - name: asottile/azure-pipeline-templates - ref: refs/tags/v2.1.0 - -jobs: -- template: job--python-tox.yml@asottile - parameters: - toxenvs: [pypy3, py36, py37, py38] - os: linux diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-3.3.1/cfgv.py new/cfgv-3.4.0/cfgv.py --- old/cfgv-3.3.1/cfgv.py 2021-08-25 16:18:18.000000000 +0200 +++ new/cfgv-3.4.0/cfgv.py 2023-08-12 22:38:08.000000000 +0200 @@ -1,3 +1,5 @@ +from __future__ import annotations + import collections import contextlib import os.path @@ -390,12 +392,15 @@ schema, load_strategy, exc_tp=ValidationError, + *, + display_filename=None, ): + display_filename = display_filename or filename with reraise_as(exc_tp): if not os.path.isfile(filename): - raise ValidationError(f'{filename} is not a file') + raise ValidationError(f'{display_filename} is not a file') - with validate_context(f'File {filename}'): + with validate_context(f'File {display_filename}'): try: with open(filename, encoding='utf-8') as f: contents = f.read() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-3.3.1/setup.cfg new/cfgv-3.4.0/setup.cfg --- old/cfgv-3.3.1/setup.cfg 2021-08-25 16:18:18.000000000 +0200 +++ new/cfgv-3.4.0/setup.cfg 2023-08-12 22:38:08.000000000 +0200 @@ -1,6 +1,6 @@ [metadata] name = cfgv -version = 3.3.1 +version = 3.4.0 description = Validate configuration and produce human readable error messages. long_description = file: README.md long_description_content_type = text/markdown @@ -8,21 +8,17 @@ author = Anthony Sottile author_email = [email protected] license = MIT -license_file = LICENSE +license_files = LICENSE classifiers = License :: OSI Approved :: MIT License Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy [options] py_modules = cfgv -python_requires = >=3.6.1 +python_requires = >=3.8 [bdist_wheel] universal = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-3.3.1/setup.py new/cfgv-3.4.0/setup.py --- old/cfgv-3.3.1/setup.py 2021-08-25 16:18:18.000000000 +0200 +++ new/cfgv-3.4.0/setup.py 2023-08-12 22:38:08.000000000 +0200 @@ -1,2 +1,4 @@ +from __future__ import annotations + from setuptools import setup setup() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-3.3.1/tests/cfgv_test.py new/cfgv-3.4.0/tests/cfgv_test.py --- old/cfgv-3.3.1/tests/cfgv_test.py 2021-08-25 16:18:18.000000000 +0200 +++ new/cfgv-3.4.0/tests/cfgv_test.py 2023-08-12 22:38:08.000000000 +0200 @@ -1,3 +1,5 @@ +from __future__ import annotations + import json from unittest import mock @@ -34,11 +36,12 @@ def _assert_exception_trace(e, trace): - inner = e - for ctx in trace[:-1]: - assert inner.ctx == ctx - inner = inner.error_msg - assert inner.error_msg == trace[-1] + parts = [] + while e.ctx is not None: + parts.append(e.ctx) + e = e.error_msg + parts.append(e.error_msg) + assert tuple(parts) == trace def test_ValidationError_simple_str(): @@ -580,6 +583,35 @@ assert ret == {'key': False} +def test_load_from_filename_custom_display_no_file(tmp_path): + with pytest.raises(ValidationError) as excinfo: + load_from_filename( + tmp_path.joinpath('cfg.json'), + map_required, + json.loads, + display_filename='cfg.json', + ) + _assert_exception_trace(excinfo.value.args[0], ('cfg.json is not a file',)) + + +def test_load_from_filename_custom_display_error(tmp_path): + f = tmp_path.joinpath('cfg.json') + f.write_text('{}') + with pytest.raises(ValidationError) as excinfo: + load_from_filename( + f, + map_required, + json.loads, + display_filename='cfg.json', + ) + expected = ( + 'File cfg.json', + 'At foo(key=MISSING)', + 'Missing required key: key', + ) + _assert_exception_trace(excinfo.value.args[0], expected) + + conditional_recurse = Map( 'Map', None, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-3.3.1/tox.ini new/cfgv-3.4.0/tox.ini --- old/cfgv-3.3.1/tox.ini 2021-08-25 16:18:18.000000000 +0200 +++ new/cfgv-3.4.0/tox.ini 2023-08-12 22:38:08.000000000 +0200 @@ -1,12 +1,12 @@ [tox] -envlist = py36,py37,pypy3,pre-commit +envlist = py,pre-commit [testenv] deps = -rrequirements-dev.txt commands = coverage erase coverage run -m pytest {posargs:tests} - coverage report --fail-under 100 + coverage report [testenv:pre-commit] skip_install = true
