Skip to content

Added opis/json-schema #478

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

Merged
merged 1 commit into from
Apr 14, 2021
Merged

Conversation

sorinsarca
Copy link
Contributor

No description provided.

@Relequestual
Copy link
Member

Great! Thanks!

You may find it easier to update tests if you use a git submodule as opposed to copy/pasting the test files =]

@Relequestual Relequestual merged commit 51b4977 into json-schema-org:master Apr 14, 2021
@sorinsarca
Copy link
Contributor Author

You may find it easier to update tests if you use a git submodule as opposed to copy/pasting the test files

I mark some tests as skipped, so I cannot use a git submodule.
For example, I must skip some test related to ecmascript regex (https://github.com/opis/json-schema/blob/master/tests/official/tests/draft2020-12/optional/ecmascript-regex.json#L91).

Regex engine in PHP is not based on ECMA-262 standard, and I'm not willing to create one :)
I'll use whatever is shipped with PHP, in this case PCRE.

@Relequestual
Copy link
Member

Relequestual commented Apr 14, 2021

In the case of optional tests, you could define rules in your test loop to determine which ones to skip =]

@sorinsarca
Copy link
Contributor Author

No thanks, I'm fine :)
I don't want to test if test should be tested or not.

@Julian
Copy link
Member

Julian commented Apr 14, 2021

Obviously what you do is up to you, but yeah I don't think mutating the files themselves is a particularly good way to implement skipping.

What I do is quite robust, because it's been many years (9+) of improving on it (https://github.com/Julian/jsonschema/blob/main/jsonschema/tests/_suite.py -- still only 200 lines or so) and initial versions were quite scrappy indeed.

But yeah would definitely not recommend doing things that way personally.

@sorinsarca
Copy link
Contributor Author

I use this test suite since 2017, and I don't mind to copy-paste the files once in a while.
Sometimes I also add extra tests, and I don't want to create another file when there is a file that already contains tests
for, let's say, multipleOf keyword. I'm lazy.

@karenetheridge
Copy link
Member

karenetheridge commented Apr 14, 2021

I do something very similar to @Julian (using a wrapper that @Relequestual created) -- the test suite is pulled in with a submodule, with a list of todo/skips, and then a separate directory of my own additional tests added in on top. I also have a separate test suite that tests things in a different way than the suite, e.g. for things that are expected to throw exceptions (because the test suite doesn't cover these at all), or checking for the exact content of annotations and errors. There's a lot more things to test for than just valid=true/false.

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.

4 participants