Skip to content

Commit

Permalink
fix: support pydantic2 by using safety_schemas 0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yeisonvargasf committed Mar 26, 2024
1 parent 4fbb211 commit 7a2245d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions setup.cfg
Expand Up @@ -49,8 +49,8 @@ install_requires =
Authlib>=1.2.0
rich
typer
pydantic>=1.10.12,<2.0
safety_schemas>=0.0.1
pydantic>=1.10.12
safety_schemas>=0.0.2
typing-extensions>=4.7.1

[options.entry_points]
Expand Down
4 changes: 2 additions & 2 deletions test_requirements.txt
Expand Up @@ -16,6 +16,6 @@ marshmallow>=3.15.0; python_version>="3.7"
Authlib>=1.2.0
rich
typer
pydantic>=1.10.12,<2.0
safety_schemas>=0.0.1
pydantic>=1.10.12
safety_schemas>=0.0.2
typing-extensions>=4.7.1
6 changes: 2 additions & 4 deletions tests/test_cli.py
Expand Up @@ -285,11 +285,9 @@ def test_validate_with_policy_file_using_invalid_keyword(self):
path = os.path.join(dirname, "test_policy_file", "v3_0", filename)
result = self.runner.invoke(cli.cli, ['validate', 'policy_file', '3.0', '--path', path])
cleaned_stdout = click.unstyle(result.stderr)
msg_hint = 'report -> dependency-vulnerabilities -> transitive\n' \
' extra fields not permitted (type=value_error.extra)\n'
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}'
msg = f'Unable to load the Safety Policy file ("{path}"), this command only supports version 3.0, details: 1 validation error for Config'

self.assertEqual(msg, cleaned_stdout)
self.assertIn(msg, cleaned_stdout)
self.assertEqual(result.exit_code, 1)


Expand Down
1 change: 1 addition & 0 deletions tests/test_safety.py
Expand Up @@ -466,6 +466,7 @@ def test_get_announcements_catch_unhandled_http_codes(self, get_used_options):
@patch("safety.util.get_used_options")
@patch.object(click, 'get_current_context', Mock(command=Mock(name=Mock(return_value='check'))))
def test_get_announcements_http_ok(self, get_used_options):
get_used_options.return_value = {}

announcements = {
"announcements": [{
Expand Down

0 comments on commit 7a2245d

Please sign in to comment.