Skip to content

Commit

Permalink
remove try-except
Browse files Browse the repository at this point in the history
  • Loading branch information
irenedea committed Oct 11, 2024
1 parent c558a13 commit 71d3c6d
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions tests/callbacks/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,12 @@ def maybe_skip_callback_test(callback_class: type):
def test_build_callback(callback_name: str, callback_class: type):
maybe_skip_callback_test(callback_class)
get_default_kwargs(callback_class)
try:
callback = build_callback(
callback_name,
kwargs=get_default_kwargs(callback_class),
)
except ImportError:
pytest.skip(f'Skipping {callback_name} because of missing import.')

callback = build_callback(
callback_name,
kwargs=get_default_kwargs(callback_class),
)

assert isinstance(callback, callback_class)
assert isinstance(callback, Callback)

Expand All @@ -115,16 +114,15 @@ def test_build_callback(callback_name: str, callback_class: type):
def test_build_callback_with_config(callback_name: str, callback_class: type):
maybe_skip_callback_test(callback_class)
get_default_kwargs(callback_class)
try:
callback = build_callback(
callback_name,
kwargs=get_default_kwargs(callback_class),
train_config={
'save_folder': 'test',
'save_interval': '1ba',
},
)
except ImportError:
pytest.skip(f'Skipping {callback_name} because of missing import.')

callback = build_callback(
callback_name,
kwargs=get_default_kwargs(callback_class),
train_config={
'save_folder': 'test',
'save_interval': '1ba',
},
)

assert isinstance(callback, callback_class)
assert isinstance(callback, CallbackWithConfig)

0 comments on commit 71d3c6d

Please sign in to comment.