-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1600 from danforthcenter/add-verbose-warn
Update warn to utilize the verbose global parameter
- Loading branch information
Showing
2 changed files
with
19 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |