Hello community,
here is the log from the commit of package python-openapi-spec-validator for
openSUSE:Leap:15.2 checked in at 2020-03-09 18:09:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-openapi-spec-validator (Old)
and /work/SRC/openSUSE:Leap:15.2/.python-openapi-spec-validator.new.26092
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-openapi-spec-validator"
Mon Mar 9 18:09:36 2020 rev:4 rq:776867 version:0.2.8
Changes:
--------
---
/work/SRC/openSUSE:Leap:15.2/python-openapi-spec-validator/python-openapi-spec-validator.changes
2020-01-15 15:50:55.695511407 +0100
+++
/work/SRC/openSUSE:Leap:15.2/.python-openapi-spec-validator.new.26092/python-openapi-spec-validator.changes
2020-03-09 18:09:37.141046367 +0100
@@ -1,0 +2,14 @@
+Wed Sep 11 08:33:01 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.2.8:
+ * no upstream changelog
+
+-------------------------------------------------------------------
+Mon Jun 3 11:11:08 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.2.7:
+ * Replace pathlib with pathlib2 (#68)
+ * Bump PyYAML to 5.1 for CVE-2017-18342 (#69)
+ * Support jsonschema 3 (#72)
+
+-------------------------------------------------------------------
Old:
----
0.2.4.tar.gz
New:
----
0.2.8.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-openapi-spec-validator.spec ++++++
--- /var/tmp/diff_new_pack.PAQEnk/_old 2020-03-09 18:09:37.885047433 +0100
+++ /var/tmp/diff_new_pack.PAQEnk/_new 2020-03-09 18:09:37.889047439 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-openapi-spec-validator
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-openapi-spec-validator
-Version: 0.2.4
+Version: 0.2.8
Release: 0
Summary: Python module for validating OpenAPI Specs against Swagger and
OAS3
License: Apache-2.0
@@ -26,19 +26,25 @@
URL: https://github.com/p1c2u/openapi-spec-validator
Source:
https://github.com/p1c2u/openapi-spec-validator/archive/%{version}.tar.gz
Patch0: openapi-spec-validator-skip-urls.patch
-BuildRequires: %{python_module PyYAML}
+BuildRequires: %{python_module PyYAML >= 5.1}
BuildRequires: %{python_module jsonschema}
+BuildRequires: %{python_module mock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
BuildRequires: fdupes
+BuildRequires: python-pathlib2
BuildRequires: python-rpm-macros
-Requires: python-PyYAML
+Requires: python-PyYAML >= 5.1
Requires: python-jsonschema
+Requires: python-setuptools
Requires: python-six
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
+%ifpython2
+Requires: python-pathlib2
+%endif
%python_subpackages
%description
@@ -66,7 +72,7 @@
%python_uninstall_alternative openapi-spec-validator
%check
-%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib}
py.test-%{$python_bin_suffix}
+%pytest
%files %{python_files}
%doc README.md
++++++ 0.2.4.tar.gz -> 0.2.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/openapi-spec-validator-0.2.4/.bumpversion.cfg
new/openapi-spec-validator-0.2.8/.bumpversion.cfg
--- old/openapi-spec-validator-0.2.4/.bumpversion.cfg 1970-01-01
01:00:00.000000000 +0100
+++ new/openapi-spec-validator-0.2.8/.bumpversion.cfg 2019-07-22
17:07:11.000000000 +0200
@@ -0,0 +1,14 @@
+[bumpversion]
+current_version = 0.2.8
+commit = True
+tag = True
+parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
+serialize =
+ {major}.{minor}.{patch}
+tag_name = {new_version}
+message = Version {new_version}
+
+[bumpversion:file:openapi_spec_validator/__init__.py]
+
+[bumpversion:file:Dockerfile]
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/openapi-spec-validator-0.2.4/.travis.yml
new/openapi-spec-validator-0.2.8/.travis.yml
--- old/openapi-spec-validator-0.2.4/.travis.yml 2018-07-31
00:12:37.000000000 +0200
+++ new/openapi-spec-validator-0.2.8/.travis.yml 2019-07-22
17:07:11.000000000 +0200
@@ -8,11 +8,15 @@
- python: 3.4
- python: 3.5
- python: 3.6
+ - python: 3.7
+ dist: xenial
+ sudo: true
- python: nightly
- python: pypy3
allow_failures:
- python: 3.2 # EOL
- python: 3.3 # EOL
+ - python: 3.4 # EOL
- python: nightly
before_install:
- if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then pip install 'coverage<4.0.0';
fi
@@ -30,7 +34,7 @@
provider: pypi
user: p1c2u
password:
- secure:
iZWZuDMIWyFtJf5cLDPwA82d7DVi+/8yBQJVowctJwkioz4PEZBrf4N7cKyFc7JlhsS0/gqPJ9nw1FBqHwlTFwikpCYjudcfVijzibwKBbTbYTbTY1xEYiv+2/Q2UGoGjGmf2qdqM9SBaQwvax+KgMO6e4I4vrX4cm3kMx4LHt0Z2ArORlhZ0oKxyi6azcFiZYwlOlp31PuV0iNpBkroBf+gQ20S35hD+GIm1U6D4zqkN0HmZ0LxlpZLXsHZ0FrEE57KU06RowWfkAFBkGjMBjr+phiZ/XRe88SFaiB3HVZaJm+ZPTJKnxryuGt5th54Q10DKLZ3KUien33saBYVziamHZ8ZYS01ztahEhqLKlQVB1e+p1M8mYXKVodqLgytOsddixIBmibq2rDJmLSPwro8RBwLhLdGZdRsH2kii06OQxPrzlUrOwtErozxvdNjS47hwjJ4ZVm4ZGcnOXZut4qwkiEEUMWUd54V+zDNnRxOf+hi/mEx3u8CmkV26XFJ7WHpr/E1T9XHuRh7YVP8MXrM3gjoL86g1swalpH/QBjf0UaF2BlTvWJ3j52uThH7MFUlCBgpYer1giJayyNjFw4+qUVMCyByD87V7x6/3glA7t4Kh0LiMq0Zo23PPbhuJOmJmDy6GTtjkXZEJ6XnNPV9+VR8LApmppevBDKafgA=
+ secure:
mQCKjaqTpkDhTRCSZtdt5d3tOs/d1vc8PDAna5Gr5prMbosq5stG3HdTK3qK5AbfNghclFYZH726zD2i4LdBWmHoA50TJn6mud3k0Byt+fEpnFIHgb8B2hhOQiiG/LxO1X+oRQI+2NL6TQagxJZzSArqaY4p83RAoLNjlf8LpgQu6qjERFkxMaSCrDfDWJ8MBFINMiZ5ZCq3NF8Rclaesv7HKAaYc8591grjouR8FBoVIPG7EWCZP8lp4CVEz6XlBZV8DDmUuhIhqWRkf6jS1zMbd0fUB7iKh2vHDHSWx9kGsxSRCqISDy3ywVUcee6O5M06RwzlpDSML+vuBHYvr8KX5LWSoaOcZfRNjGYIv437t+81Bl1d34GogI/Abm8WxG92KYt5+//6bKk7byck76ZLvuxV/lPtLjg0Caya9zVk/SE0GEa5N+Da04SHJqML88dS9ImbKchOnP1nUb/oUFA8SADFaMonxLbqe2k+PTLymZVTv0apPpiDXKpUF0K1+1WdggDRyr9WFhoBB7KYme6uQLLi78vmDo4gZzG+NvPYoux/VVsbm+upZdqRFL1jX8GGYMu/VbFwN3EHCAH3b6kFZFijZuTgCsIGvMfU2j/tJpLGUJLN8uLJlN88PqPxU4iz7lVKRU29hLwnCWY9yjPdTCZn0gdcZuosv6leNlc=
distributions: sdist bdist_wheel
on:
tags: true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/openapi-spec-validator-0.2.4/Dockerfile
new/openapi-spec-validator-0.2.8/Dockerfile
--- old/openapi-spec-validator-0.2.4/Dockerfile 1970-01-01 01:00:00.000000000
+0100
+++ new/openapi-spec-validator-0.2.8/Dockerfile 2019-07-22 17:07:11.000000000
+0200
@@ -0,0 +1,7 @@
+FROM python:3.7-alpine
+
+ARG OPENAPI_SPEC_VALIDATOR_VERSION=0.2.8
+
+RUN pip install --no-cache-dir
openapi-spec-validator==${OPENAPI_SPEC_VALIDATOR_VERSION}
+
+ENTRYPOINT ["openapi-spec-validator"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/openapi-spec-validator-0.2.4/Makefile
new/openapi-spec-validator-0.2.8/Makefile
--- old/openapi-spec-validator-0.2.4/Makefile 1970-01-01 01:00:00.000000000
+0100
+++ new/openapi-spec-validator-0.2.8/Makefile 2019-07-22 17:07:11.000000000
+0200
@@ -0,0 +1,45 @@
+.EXPORT_ALL_VARIABLES:
+
+PROJECT_NAME=openapi-spec-validator
+PACKAGE_NAME=$(subst -,_,${PROJECT_NAME})
+VERSION=`git describe --abbrev=0`
+
+DOCKER_REGISTRY=p1c2u
+
+PYTHONDONTWRITEBYTECODE=1
+
+params:
+ @echo "Project name: ${PROJECT_NAME}"
+ @echo "Package name: ${PACKAGE_NAME}"
+ @echo "Version: ${VERSION}"
+
+dist-build:
+ @python setup.py bdist_wheel
+
+dist-cleanup:
+ @rm -rf build dist ${PACKAGE_NAME}.egg-info
+
+dist-upload:
+ @twine upload dist/*.whl
+
+test-python:
+ @python setup.py test
+
+test-cache-cleanup:
+ @rm -rf .pytest_cache
+
+reports-cleanup:
+ @rm -rf reports
+
+test-cleanup: test-cache-cleanup reports-cleanup
+
+cleanup: dist-cleanup test-cleanup
+
+docker-build:
+ @docker build --no-cache --build-arg
OPENAPI_SPEC_VALIDATOR_VERSION=${VERSION} -t ${PROJECT_NAME}:${VERSION} .
+
+docker-tag:
+ @docker tag ${PROJECT_NAME}:${VERSION}
${DOCKER_REGISTRY}/${PROJECT_NAME}:${VERSION}
+
+docker-push:
+ @docker push ${DOCKER_REGISTRY}/${PROJECT_NAME}:${VERSION}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/openapi-spec-validator-0.2.4/README.md
new/openapi-spec-validator-0.2.8/README.md
--- old/openapi-spec-validator-0.2.4/README.md 2018-07-31 00:12:37.000000000
+0200
+++ new/openapi-spec-validator-0.2.8/README.md 2019-07-22 17:07:11.000000000
+0200
@@ -25,6 +25,12 @@
$ openapi-spec-validator some.yaml
```
+pipes way:
+
+```bash
+$ cat some.yaml | openapi-spec-validator -
+```
+
or more pythonic way:
```bash
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/openapi-spec-validator-0.2.4/openapi_spec_validator/__init__.py
new/openapi-spec-validator-0.2.8/openapi_spec_validator/__init__.py
--- old/openapi-spec-validator-0.2.4/openapi_spec_validator/__init__.py
2018-07-31 00:12:37.000000000 +0200
+++ new/openapi-spec-validator-0.2.8/openapi_spec_validator/__init__.py
2019-07-22 17:07:11.000000000 +0200
@@ -2,14 +2,14 @@
from openapi_spec_validator.shortcuts import (
validate_spec_factory, validate_spec_url_factory,
)
-from openapi_spec_validator.handlers import UrlHandler
+from openapi_spec_validator.handlers import UrlHandler, FileObjectHandler
from openapi_spec_validator.schemas import get_openapi_schema
from openapi_spec_validator.factories import JSONSpecValidatorFactory
from openapi_spec_validator.validators import SpecValidator
__author__ = 'Artur Maciag'
__email__ = '[email protected]'
-__version__ = '0.2.4'
+__version__ = '0.2.8'
__url__ = 'https://github.com/p1c2u/openapi-spec-validator'
__license__ = 'Apache License, Version 2.0'
@@ -19,8 +19,10 @@
'validate_v2_spec_url', 'validate_v3_spec_url', 'validate_spec_url',
]
+file_object_handler = FileObjectHandler()
+all_urls_handler = UrlHandler('http', 'https', 'file')
default_handlers = {
- '<all_urls>': UrlHandler('http', 'https', 'file'),
+ '<all_urls>': all_urls_handler,
'http': UrlHandler('http'),
'https': UrlHandler('https'),
'file': UrlHandler('file'),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/openapi-spec-validator-0.2.4/openapi_spec_validator/__main__.py
new/openapi-spec-validator-0.2.8/openapi_spec_validator/__main__.py
--- old/openapi-spec-validator-0.2.4/openapi_spec_validator/__main__.py
2018-07-31 00:12:37.000000000 +0200
+++ new/openapi-spec-validator-0.2.8/openapi_spec_validator/__main__.py
2019-07-22 17:07:11.000000000 +0200
@@ -1,9 +1,16 @@
import logging
import argparse
import os
+try:
+ import pathlib
+except ImportError:
+ import pathlib2 as pathlib
import sys
-from openapi_spec_validator import validate_spec_url, validate_v2_spec_url
+from openapi_spec_validator import (
+ openapi_v2_spec_validator, openapi_v3_spec_validator, all_urls_handler,
+ file_object_handler,
+)
from openapi_spec_validator.exceptions import ValidationError
logger = logging.getLogger(__name__)
@@ -13,6 +20,19 @@
)
+def read_from_stdin(filename):
+ return file_object_handler(sys.stdin), ''
+
+
+def read_from_filename(filename):
+ if not os.path.isfile(filename):
+ raise SystemError("No such file {0}".format(filename))
+
+ filename = os.path.abspath(filename)
+ uri = pathlib.Path(filename).as_uri()
+ return all_urls_handler(uri), uri
+
+
def main(args=None):
parser = argparse.ArgumentParser()
parser.add_argument('filename', help="Absolute or relative path to file")
@@ -24,21 +44,34 @@
default='3.0.0'
)
args = parser.parse_args(args)
- filename = args.filename
- filename = os.path.abspath(filename)
+
+ # choose source
+ reader = read_from_filename
+ if args.filename in ['-', '/-']:
+ reader = read_from_stdin
+
+ # read source
+ try:
+ spec, spec_url = reader(args.filename)
+ except Exception as exc:
+ print(exc)
+ sys.exit(1)
+
# choose the validator
- if args.schema == '2.0':
- validate_url = validate_v2_spec_url
- elif args.schema == '3.0.0':
- validate_url = validate_spec_url
+ validators = {
+ '2.0': openapi_v2_spec_validator,
+ '3.0.0': openapi_v3_spec_validator,
+ }
+ validator = validators[args.schema]
+
# validate
try:
- validate_url('file://'+filename)
- except ValidationError as e:
- print(e)
+ validator.validate(spec, spec_url=spec_url)
+ except ValidationError as exc:
+ print(exc)
sys.exit(1)
- except Exception as e:
- print(e)
+ except Exception as exc:
+ print(exc)
sys.exit(2)
else:
print('OK')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/openapi-spec-validator-0.2.4/openapi_spec_validator/generators.py
new/openapi-spec-validator-0.2.8/openapi_spec_validator/generators.py
--- old/openapi-spec-validator-0.2.4/openapi_spec_validator/generators.py
2018-07-31 00:12:37.000000000 +0200
+++ new/openapi-spec-validator-0.2.8/openapi_spec_validator/generators.py
2019-07-22 17:07:11.000000000 +0200
@@ -2,7 +2,7 @@
import logging
from six import iteritems
-from jsonschema import _validators
+from jsonschema.validators import Draft4Validator
from openapi_spec_validator.decorators import DerefValidatorDecorator
@@ -13,21 +13,20 @@
"""Generator factory for customized validators that follows $refs
in the schema being validated.
"""
-
validators = {
- '$ref': _validators.ref,
- 'properties': _validators.properties_draft4,
- 'additionalProperties': _validators.additionalProperties,
- 'patternProperties': _validators.patternProperties,
- 'type': _validators.type_draft4,
- 'dependencies': _validators.dependencies,
- 'required': _validators.required_draft4,
- 'minProperties': _validators.minProperties_draft4,
- 'maxProperties': _validators.maxProperties_draft4,
- 'allOf': _validators.allOf_draft4,
- 'oneOf': _validators.oneOf_draft4,
- 'anyOf': _validators.anyOf_draft4,
- 'not': _validators.not_draft4,
+ '$ref',
+ 'properties',
+ 'additionalProperties',
+ 'patternProperties',
+ 'type',
+ 'dependencies',
+ 'required',
+ 'minProperties',
+ 'maxProperties',
+ 'allOf',
+ 'oneOf',
+ 'anyOf',
+ 'not',
}
@classmethod
@@ -38,5 +37,6 @@
:type instance_resolver: :class:`jsonschema.RefResolver`
"""
deref = DerefValidatorDecorator(spec_resolver)
- for key, validator_callable in iteritems(cls.validators):
- yield key, deref(validator_callable)
+ for key, validator_callable in iteritems(Draft4Validator.VALIDATORS):
+ if key in cls.validators:
+ yield key, deref(validator_callable)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/openapi-spec-validator-0.2.4/openapi_spec_validator/handlers.py
new/openapi-spec-validator-0.2.8/openapi_spec_validator/handlers.py
--- old/openapi-spec-validator-0.2.4/openapi_spec_validator/handlers.py
2018-07-31 00:12:37.000000000 +0200
+++ new/openapi-spec-validator-0.2.8/openapi_spec_validator/handlers.py
2019-07-22 17:07:11.000000000 +0200
@@ -8,19 +8,30 @@
from openapi_spec_validator.loaders import ExtendedSafeLoader
-class UrlHandler:
- """OpenAPI spec validator URL scheme handler."""
+class FileObjectHandler(object):
+ """OpenAPI spec validator file-like object handler."""
- def __init__(self, *allowed_schemes, **options):
- self.allowed_schemes = allowed_schemes
+ def __init__(self, **options):
self.options = options
@property
def loader(self):
return self.options.get('loader', ExtendedSafeLoader)
+ def __call__(self, f):
+ return load(f, self.loader)
+
+
+class UrlHandler(FileObjectHandler):
+ """OpenAPI spec validator URL scheme handler."""
+
+ def __init__(self, *allowed_schemes, **options):
+ super(UrlHandler, self).__init__(**options)
+ self.allowed_schemes = allowed_schemes
+
def __call__(self, url, timeout=1):
assert urlparse(url).scheme in self.allowed_schemes
- with contextlib.closing(urlopen(url, timeout=timeout)) as fh:
- return load(fh, self.loader)
+ f = urlopen(url, timeout=timeout)
+ with contextlib.closing(f) as fh:
+ return super(UrlHandler, self).__call__(fh)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/openapi-spec-validator-0.2.4/requirements.txt
new/openapi-spec-validator-0.2.8/requirements.txt
--- old/openapi-spec-validator-0.2.4/requirements.txt 2018-07-31
00:12:37.000000000 +0200
+++ new/openapi-spec-validator-0.2.8/requirements.txt 2019-07-22
17:07:11.000000000 +0200
@@ -1,3 +1,3 @@
-jsonschema==2.6.0
-PyYAML==3.13
-six==1.11.0
+jsonschema
+PyYAML==4.2b4
+six==1.12.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/openapi-spec-validator-0.2.4/requirements_dev.txt
new/openapi-spec-validator-0.2.8/requirements_dev.txt
--- old/openapi-spec-validator-0.2.4/requirements_dev.txt 2018-07-31
00:12:37.000000000 +0200
+++ new/openapi-spec-validator-0.2.8/requirements_dev.txt 2019-07-22
17:07:11.000000000 +0200
@@ -1,6 +1,5 @@
mock==2.0.0
pytest==3.5.0
-pytest-pep8==1.0.6
-pytest-flakes==2.0.0
+pytest-flake8
pytest-cov==2.5.1
tox==3.0.0rc4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/openapi-spec-validator-0.2.4/setup.py
new/openapi-spec-validator-0.2.8/setup.py
--- old/openapi-spec-validator-0.2.4/setup.py 2018-07-31 00:12:37.000000000
+0200
+++ new/openapi-spec-validator-0.2.8/setup.py 2019-07-22 17:07:11.000000000
+0200
@@ -27,10 +27,11 @@
TestCommand.finalize_options(self)
self.test_args = [
'-sv',
- '--pep8',
- '--flakes',
+ '--flake8',
+ '--junitxml', 'reports/junit.xml',
'--cov', 'openapi_spec_validator',
'--cov-report', 'term-missing',
+ '--cov-report', 'xml:reports/coverage.xml',
]
self.test_suite = True
@@ -54,6 +55,7 @@
url=metadata['url'],
license=metadata['license'],
long_description=read_file('README.md'),
+ long_description_content_type='text/markdown',
packages=find_packages(include=('openapi_spec_validator*',)),
package_data={
'openapi_spec_validator': [
@@ -69,14 +71,14 @@
},
install_requires=[
"jsonschema",
- "PyYAML",
+ "PyYAML>=5.1",
"six",
+ 'pathlib2;python_version=="2.7"',
],
tests_require=[
"mock",
"pytest",
- "pytest-pep8",
- "pytest-flakes",
+ "pytest-flake8",
"pytest-cov",
"tox",
],
@@ -87,8 +89,8 @@
"Topic :: Software Development :: Libraries :: Python Modules",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2.7",
- "Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
+ "Programming Language :: Python :: 3.7",
],
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/openapi-spec-validator-0.2.4/tests/integration/test_main.py
new/openapi-spec-validator-0.2.8/tests/integration/test_main.py
--- old/openapi-spec-validator-0.2.4/tests/integration/test_main.py
2018-07-31 00:12:37.000000000 +0200
+++ new/openapi-spec-validator-0.2.8/tests/integration/test_main.py
2019-07-22 17:07:11.000000000 +0200
@@ -1,4 +1,7 @@
+import mock
+
import pytest
+from six import StringIO
from openapi_spec_validator.__main__ import main
@@ -39,8 +42,32 @@
main(testargs)
[email protected](
+ 'openapi_spec_validator.__main__.openapi_v3_spec_validator.validate',
+ side_effect=Exception,
+)
+def test_unknown_error(m_validate):
+ """SystemExit on running with unknown error."""
+ testargs = ['--schema', '3.0.0',
+ './tests/integration/data/v2.0/petstore.yaml']
+ with pytest.raises(SystemExit):
+ main(testargs)
+
+
def test_nonexisting_file():
"""Calling with non-existing file should sys.exit."""
testargs = ['i_dont_exist.yaml']
with pytest.raises(SystemExit):
main(testargs)
+
+
+def test_schema_stdin():
+ """Test schema from STDIN"""
+ spes_path = './tests/integration/data/v3.0/petstore.yaml'
+ with open(spes_path, 'r') as spec_file:
+ spec_lines = spec_file.readlines()
+ spec_io = StringIO("".join(spec_lines))
+
+ testargs = ['-']
+ with mock.patch('openapi_spec_validator.__main__.sys.stdin', spec_io):
+ main(testargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/openapi-spec-validator-0.2.4/tox.ini
new/openapi-spec-validator-0.2.8/tox.ini
--- old/openapi-spec-validator-0.2.4/tox.ini 2018-07-31 00:12:37.000000000
+0200
+++ new/openapi-spec-validator-0.2.8/tox.ini 2019-07-22 17:07:11.000000000
+0200
@@ -1,5 +1,5 @@
[tox]
-envlist = {py27,py34,py35,py36}-{default,simplejson}
+envlist = {py27,py35,py36}-{default,simplejson}
[testenv]
deps =