1
0
Fork 0

Adding upstream version 3.3.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 20:42:17 +01:00
parent 2f72ef8d68
commit 8a475bec34
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
7 changed files with 24 additions and 14 deletions

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
github: asottile

View file

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0 rev: v4.0.1
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
- id: end-of-file-fixer - id: end-of-file-fixer
@ -9,30 +9,30 @@ repos:
- id: debug-statements - id: debug-statements
- id: name-tests-test - id: name-tests-test
- id: requirements-txt-fixer - id: requirements-txt-fixer
- repo: https://gitlab.com/pycqa/flake8 - repo: https://github.com/PyCQA/flake8
rev: 3.8.0 rev: 3.9.2
hooks: hooks:
- id: flake8 - id: flake8
- repo: https://github.com/pre-commit/mirrors-autopep8 - repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.5.2 rev: v1.5.7
hooks: hooks:
- id: autopep8 - id: autopep8
- repo: https://github.com/asottile/reorder_python_imports - repo: https://github.com/asottile/reorder_python_imports
rev: v2.3.0 rev: v2.5.0
hooks: hooks:
- id: reorder-python-imports - id: reorder-python-imports
args: [--py3-plus] args: [--py3-plus]
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v2.4.1 rev: v2.16.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py36-plus] args: [--py36-plus]
- repo: https://github.com/asottile/add-trailing-comma - repo: https://github.com/asottile/add-trailing-comma
rev: v2.0.1 rev: v2.1.0
hooks: hooks:
- id: add-trailing-comma - id: add-trailing-comma
args: [--py36-plus] args: [--py36-plus]
- repo: https://github.com/asottile/setup-cfg-fmt - repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.9.0 rev: v1.17.0
hooks: hooks:
- id: setup-cfg-fmt - id: setup-cfg-fmt

View file

@ -1,5 +1,6 @@
[![Build Status](https://dev.azure.com/asottile/asottile/_apis/build/status/asottile.cfgv?branchName=master)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=24&branchName=master) [![Build Status](https://dev.azure.com/asottile/asottile/_apis/build/status/asottile.cfgv?branchName=master)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=24&branchName=master)
[![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/asottile/asottile/24/master.svg)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=24&branchName=master) [![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/asottile/asottile/24/master.svg)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=24&branchName=master)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/asottile/cfgv/master.svg)](https://results.pre-commit.ci/latest/github/asottile/cfgv/master)
cfgv cfgv
==== ====

View file

@ -10,10 +10,9 @@ resources:
type: github type: github
endpoint: github endpoint: github
name: asottile/azure-pipeline-templates name: asottile/azure-pipeline-templates
ref: refs/tags/v1.0.1 ref: refs/tags/v2.1.0
jobs: jobs:
- template: job--pre-commit.yml@asottile
- template: job--python-tox.yml@asottile - template: job--python-tox.yml@asottile
parameters: parameters:
toxenvs: [pypy3, py36, py37, py38] toxenvs: [pypy3, py36, py37, py38]

View file

@ -392,8 +392,8 @@ def load_from_filename(
exc_tp=ValidationError, exc_tp=ValidationError,
): ):
with reraise_as(exc_tp): with reraise_as(exc_tp):
if not os.path.exists(filename): if not os.path.isfile(filename):
raise ValidationError(f'{filename} does not exist') raise ValidationError(f'{filename} is not a file')
with validate_context(f'File {filename}'): with validate_context(f'File {filename}'):
try: try:

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = cfgv name = cfgv
version = 3.2.0 version = 3.3.0
description = Validate configuration and produce human readable error messages. description = Validate configuration and produce human readable error messages.
long_description = file: README.md long_description = file: README.md
long_description_content_type = text/markdown long_description_content_type = text/markdown
@ -16,6 +16,7 @@ classifiers =
Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy Programming Language :: Python :: Implementation :: PyPy

View file

@ -529,7 +529,15 @@ class Error(Exception):
def test_load_from_filename_file_does_not_exist(): def test_load_from_filename_file_does_not_exist():
with pytest.raises(Error) as excinfo: with pytest.raises(Error) as excinfo:
load_from_filename('does_not_exist', map_required, json.loads, Error) load_from_filename('does_not_exist', map_required, json.loads, Error)
assert excinfo.value.args[0].error_msg == 'does_not_exist does not exist' assert excinfo.value.args[0].error_msg == 'does_not_exist is not a file'
def test_load_from_filename_not_a_file(tmpdir):
with tmpdir.as_cwd():
tmpdir.join('f').ensure_dir()
with pytest.raises(Error) as excinfo:
load_from_filename('f', map_required, json.loads, Error)
assert excinfo.value.args[0].error_msg == 'f is not a file'
def test_load_from_filename_unicode_error(tmp_path): def test_load_from_filename_unicode_error(tmp_path):