Skip to content

Commit

Permalink
fastjsonschema forwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored and radoering committed Sep 23, 2023
1 parent c9fbd5a commit 288cb05
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
12 changes: 9 additions & 3 deletions tests/console/commands/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ def test_check_invalid(

tester.execute("--lock")

expected = """\
Error: 'description' is a required property
jsonschema_error = "'description' is a required property"
fastjsonschema_error = "data must contain ['description'] properties"
expected_template = """\
Error: {schema_error}
Error: Project name (invalid) is same as one of its dependencies
Error: Unrecognized classifiers: ['Intended Audience :: Clowns'].
Error: Declared README file does not exist: never/exists.md
Expand All @@ -93,8 +95,12 @@ def test_check_invalid(
'Topic :: Communications :: Chat :: AOL Instant Messenger'.\
Must be removed.
"""
expected = {
expected_template.format(schema_error=schema_error)
for schema_error in (jsonschema_error, fastjsonschema_error)
}

assert tester.io.fetch_error() == expected
assert tester.io.fetch_error() in expected


def test_check_private(
Expand Down
14 changes: 11 additions & 3 deletions tests/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,20 @@ def test_create_poetry_fails_on_invalid_configuration(
with pytest.raises(RuntimeError) as e:
Factory().create_poetry(fixture_dir("invalid_pyproject") / "pyproject.toml")

expected = """\
jsonschema_error = "'description' is a required property"
fastjsonschema_error = "data must contain ['description'] properties"

expected_template = """\
The Poetry configuration is invalid:
- 'description' is a required property
- {schema_error}
- Project name (invalid) is same as one of its dependencies
"""
assert str(e.value) == expected
expected = {
expected_template.format(schema_error=schema_error)
for schema_error in (jsonschema_error, fastjsonschema_error)
}

assert str(e.value) in expected


def test_create_poetry_with_local_config(fixture_dir: FixtureDirGetter) -> None:
Expand Down

0 comments on commit 288cb05

Please sign in to comment.