Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage warnings in test_Data #323

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Suppress specific expected spammy warnings in test_Data
  • Loading branch information
sadielbartholomew committed Feb 14, 2022
commit ac98d19e9fa14776cd839c95234e8631797db750
18 changes: 18 additions & 0 deletions cf/test/test_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import itertools
import os
import unittest
import warnings
from functools import reduce
from operator import mul

Expand Down Expand Up @@ -135,6 +136,23 @@ class DataTest(unittest.TestCase):
# test_only = ['test_Data_clip']
# test_only = ['test_Data__init__dtype_mask']

def setUp(self):
# Suppress the warning output for some specific warnings which are
# expected due to the nature of the tests being performed.
expexted_warning_msgs = [
"divide by zero encountered in arctanh",
"invalid value encountered in arctanh",
"divide by zero encountered in log",
"invalid value encountered in log",
"invalid value encountered in arcsin",
]
for expected_warning in expexted_warning_msgs:
warnings.filterwarnings(
"ignore",
category=RuntimeWarning,
message=expected_warning,
)

def test_Data_equals(self):
if self.test_only and inspect.stack()[0][3] not in self.test_only:
return
Expand Down