Skip to content

Commit 9cb3d3f

Browse files
fix: support pydantic2 by using safety_schemas 0.0.2 (#509)
1 parent 4fbb211 commit 9cb3d3f

4 files changed

Lines changed: 7 additions & 8 deletions

File tree

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ install_requires =
4949
Authlib>=1.2.0
5050
rich
5151
typer
52-
pydantic>=1.10.12,<2.0
53-
safety_schemas>=0.0.1
52+
pydantic>=1.10.12
53+
safety_schemas>=0.0.2
5454
typing-extensions>=4.7.1
5555

5656
[options.entry_points]

test_requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ marshmallow>=3.15.0; python_version>="3.7"
1616
Authlib>=1.2.0
1717
rich
1818
typer
19-
pydantic>=1.10.12,<2.0
20-
safety_schemas>=0.0.1
19+
pydantic>=1.10.12
20+
safety_schemas>=0.0.2
2121
typing-extensions>=4.7.1

tests/test_cli.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,9 @@ def test_validate_with_policy_file_using_invalid_keyword(self):
285285
path = os.path.join(dirname, "test_policy_file", "v3_0", filename)
286286
result = self.runner.invoke(cli.cli, ['validate', 'policy_file', '3.0', '--path', path])
287287
cleaned_stdout = click.unstyle(result.stderr)
288-
msg_hint = 'report -> dependency-vulnerabilities -> transitive\n' \
289-
' extra fields not permitted (type=value_error.extra)\n'
290-
msg = f'Unable to load the Safety Policy file ("{path}"), this command only supports version 3.0, details: 1 validation error for Config\n{msg_hint}'
288+
msg = f'Unable to load the Safety Policy file ("{path}"), this command only supports version 3.0, details: 1 validation error for Config'
291289

292-
self.assertEqual(msg, cleaned_stdout)
290+
self.assertIn(msg, cleaned_stdout)
293291
self.assertEqual(result.exit_code, 1)
294292

295293

tests/test_safety.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ def test_get_announcements_catch_unhandled_http_codes(self, get_used_options):
466466
@patch("safety.util.get_used_options")
467467
@patch.object(click, 'get_current_context', Mock(command=Mock(name=Mock(return_value='check'))))
468468
def test_get_announcements_http_ok(self, get_used_options):
469+
get_used_options.return_value = {}
469470

470471
announcements = {
471472
"announcements": [{

0 commit comments

Comments
 (0)