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

Mission "clean test logs" - handles all kind of userwarnings/deprecation warnings #1888

Merged
merged 21 commits into from Sep 22, 2017
Commits
Jump to file or symbol
Failed to load files and symbols.
+6 −12
Diff settings

Always

Just for now

Viewing a subset of changes. View all

just ignore those UserWarnings

  • Loading branch information...
barsch authored and krischer committed Sep 13, 2017
commit 361ff01d76610fcf8cde6d5b0ec925388de83dd4
@@ -781,11 +781,9 @@ def test_merge_with_different_calibration_factors(self):
tr2.stats.calib = 2.0
st = Stream([tr1, tr2])
# this also emits an UserWarning
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always', UserWarning)
with warnings.catch_warnings():
warnings.simplefilter('ignore', UserWarning)
self.assertRaises(Exception, st.merge)
self.assertEqual(w[0].category, UserWarning)
self.assertIn('Incompatible traces', str(w[0]))
# 2 - different calibration factors for the different channels is ok
tr1 = Trace(data=np.zeros(5))
tr1.stats.calib = 2.00
@@ -813,11 +811,9 @@ def test_merge_with_different_sampling_rates(self):
tr2.stats.sampling_rate = 50
st = Stream([tr1, tr2])
# this also emits an UserWarning
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always', UserWarning)
with warnings.catch_warnings():
warnings.simplefilter('ignore', UserWarning)
self.assertRaises(Exception, st.merge)
self.assertEqual(w[0].category, UserWarning)
self.assertIn('Incompatible traces', str(w[0]))
# 2 - different sampling rates for the different channels is ok
tr1 = Trace(data=np.zeros(5))
tr1.stats.sampling_rate = 200
@@ -843,11 +839,9 @@ def test_merge_with_different_data_types(self):
tr2 = Trace(data=np.zeros(5, dtype=np.float32))
st = Stream([tr1, tr2])
# this also emits an UserWarning
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always', UserWarning)
with warnings.catch_warnings():
warnings.simplefilter('ignore', UserWarning)
self.assertRaises(Exception, st.merge)
self.assertEqual(w[0].category, UserWarning)
self.assertIn('Incompatible traces', str(w[0]))
# 2 - different sampling rates for the different channels is ok
tr1 = Trace(data=np.zeros(5, dtype=np.int32))
tr1.stats.channel = 'EHE'
ProTip! Use n and p to navigate between commits in a pull request.