Skip to content

jsonschema: Fix non http/https url RefResolution exception #439

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

Closed
wants to merge 1 commit into from

Conversation

knsathya
Copy link

When using file:///schema-dir-name URLs we are hitting AttributeError
exception during refresolution. Reason for it is, there isn't any
context manager implemented for urlopen (i.e. it doesn't have
enter and exit methods defined).

This patch fixes this issue.

Signed-off-by: Kuppuswamy Sathyanarayanan [email protected]

When using file:///schema-dir-name URLs we are hitting AttributeError
exception during refresolution. Reason for it is, there isn't any
context manager implemented for urlopen (i.e. it doesn't have
__enter__ and __exit__ methods defined).

This patch fixes this issue.

Signed-off-by: Kuppuswamy Sathyanarayanan <[email protected]>
@Julian
Copy link
Member

Julian commented Jul 20, 2018

This is a bug introduced by #427, which was just merged.

I was unhappy with the test submitted, but didn't have enough time to fully fix it or explain to the submitter why :/

That'll teach me I suppose.

The test here needs to be a "normal" test, no mocking (#335).

The correct implementation of this likely will use contextlib.closing, in order to fix #427's underlying issue as well as this one.

Would you be able to try writing one?

@gaetano-guerriero gaetano-guerriero mentioned this pull request Oct 2, 2018
@Julian Julian closed this Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants