jacksmith15 / statham-schema

Statham is a Python Model Parsing Library for JSON Schema.
https://statham-schema.readthedocs.io/en/latest/
MIT License
38 stars 11 forks source link

Failing tests on master #94

Closed SolidTux closed 1 year ago

SolidTux commented 1 year ago
@SolidTux Thanks again for submitting. I've proposed a few changes to the intended behaviour, but implementation otherwise looks good.

[test_that_main_produces_expected_output](https://github.com/jacksmith15/statham-schema/blob/master/tests/component/test_generation.py#L19) fails on a few cases where the schema under test contains descriptions. This test just runs code generation on each of the schemas in [tests/jsonschemas/](https://github.com/jacksmith15/statham-schema/tree/master/tests/jsonschemas) and compares the resulting ASTs to the corresponding files in [tests/models/](https://github.com/jacksmith15/statham-schema/tree/master/tests/models).

Resolving these should be as simple as updating the files in [tests/models/](https://github.com/jacksmith15/statham-schema/tree/master/tests/models) to include the appropriate docstrings and description fields.

Originally posted by @jacksmith15 in https://github.com/jacksmith15/statham-schema/issues/93#issuecomment-1636728318

SolidTux commented 1 year ago

I did everything in a fresh virtualenv (created with pipenv for Python 3.9.2) and still get errors, mostly of the form

E1136: Value 'Union' is unsubscriptable (unsubscriptable-object)

or

AttributeError: 'Name' object has no attribute 'value'

The full log is attached.

tests.log

jacksmith15 commented 1 year ago

E1136: Value 'Union' is unsubscriptable (unsubscriptable-object)

This is an old bug with pylint on Python 3.9. I suspect the AttributeError is also a pylint bug.

https://github.com/pylint-dev/pylint/issues/3882

Tests pass with Python 3.6, which is the minimum supported version of this library.

jacksmith15 commented 1 year ago

I bumped the test dependencies in https://github.com/jacksmith15/statham-schema/commit/5f87c63e4d87687964b997e786c8fffc11d7e43b

I believe this issue should now be resolved.