Skip to content

Commit

Permalink
Merge pull request #1600 from danforthcenter/add-verbose-warn
Browse files Browse the repository at this point in the history
Update warn to utilize the verbose global parameter
  • Loading branch information
nfahlgren authored Sep 26, 2024
2 parents 1429294 + 6692372 commit 18462e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
17 changes: 12 additions & 5 deletions plantcv/plantcv/warn.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# Warnings handling

import sys
from plantcv.plantcv import params


def warn(warning):
"""Print out warning message
"""Print a warning message to stderr.
Inputs:
warning = warning message text
Parameters
----------
warning : str
Warning message to print.
:param warning: str
Returns
-------
None
Function does not return anything.
"""
print(f"Warning: {warning}", file=sys.stderr)
if params.verbose:
print(f"Warning: {warning}", file=sys.stderr)
7 changes: 7 additions & 0 deletions tests/plantcv/test_warn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from plantcv.plantcv import warn


def test_warn():
"""Test for PlantCV."""
warn("This is a warning message.")
assert True

0 comments on commit 18462e5

Please sign in to comment.