-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix tests for minimum properties and items #432
Fix tests for minimum properties and items #432
Conversation
In JSON Schema validation for minimum properties and items the data should be non-empty.
Add validation messages for empty properties and items that should be non-empty.
Use decorator @pytest.hookimpl(trylast=True) instead @pytest.mark.trylast
Change literal comparations from 'is' to '=='.
The pipeline for python 3.8 has jsonschema==3.2.0, for other versions it has jsonschema>=3.2.0 (at present 4.21.1). The old version of JSON Schema allows valid empty properties and items, contrary to latest versions. Can we change jsonschema version in tox.ini like this?
|
The reason for that test suite is to run the tests with the minimum valid package version, so it must be Please make sure to update setup.py too:
Thank you so much for your interest in this project! Edit: Fix typo in testenv:min where |
@VMRuiz thanks for your explanation! Until version 4.20.0 (included) the behaviour is the same of version 3.2.0. JSON Schema validation for minimum properties and items has recently changed from version 4.21.0 (at present the latest is 4.21.1). Can we use the following configuration?
|
Yes, please go ahead an introduce these changes in your PR |
From version 4.21.0 JSON Schema to validation for minimum properties and items the data should be non-empty.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #432 +/- ##
=======================================
Coverage 79.39% 79.39%
=======================================
Files 76 76
Lines 3222 3223 +1
Branches 534 534
=======================================
+ Hits 2558 2559 +1
Misses 593 593
Partials 71 71 ☔ View full report in Codecov by Sentry. |
Merged, thanks for you work @rochamatcomp |
* Fix tests for minimum properties and items In JSON Schema validation for minimum properties and items the data should be non-empty. * Add tests for invalid empty properties and items Add validation messages for empty properties and items that should be non-empty. * Fix warning from pytest trylast Use decorator @pytest.hookimpl(trylast=True) instead @pytest.mark.trylast * Fix warnings about literal comparations with 'is' Change literal comparations from 'is' to '=='. * Apply pre-commit * Use jsonschema >= 3.2.0 for all python versions * Define minimum version for JSON Schema From version 4.21.0 JSON Schema to validation for minimum properties and items the data should be non-empty.
In JSON Schema validation for minimum properties and items the data should be non-empty, then I changed the minimum properties e items configuration to 2. To test empty cases as invalid I create corresponding tests.
I fixed some simples warnings such as warning from pytest trylast and about literal comparations with 'is'.