Skip to content

Commit

Permalink
More CI tests coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
gmaze committed Oct 15, 2024
1 parent c83c138 commit ff63703
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 1 deletion.
69 changes: 69 additions & 0 deletions argopy/tests/test_utils_decorators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import pytest
import warnings

from argopy.utils.decorators import DocInherit, deprecated


def test_DocInherit():

class Profile(object):
def load(self):
"""Dummy"""
pass

class Float(Profile):
@DocInherit
def load(self):
pass

assert Float.load.__doc__ == Profile.load.__doc__


def test_deprecated_no_reason():

@deprecated
def dummy_fct():
"""Dummy"""
pass

with pytest.deprecated_call():
dummy_fct()


def test_deprecated_with_a_reason():

@deprecated("Because !")
def dummy_fct():
"""Dummy"""
pass

with pytest.deprecated_call(match="Because"):
dummy_fct()



def test_deprecated_with_a_reason_and_version():

@deprecated("Because !", version='12.0')
def dummy_fct():
"""Dummy"""
pass

with pytest.deprecated_call(match="Deprecated since version"):
dummy_fct()


def test_deprecated_ignore_caller():

@deprecated("Because !", ignore_caller='caller_to_be_ignored')
def dummy_fct():
"""Dummy"""
pass

def caller_to_be_ignored():
dummy_fct()
pass

with warnings.catch_warnings():
# warnings.simplefilter("error")
caller_to_be_ignored()
4 changes: 3 additions & 1 deletion argopy/tests/test_utils_monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ def test_fetch_status():

@requires_ipywidgets
def test_monitor_status():
monitor_status()
ms = monitor_status()
assert ms.runner in ['notebook', 'terminal', 'standard', False]
assert isinstance(ms.content, str)

0 comments on commit ff63703

Please sign in to comment.