MCPcopy Create free account
hub / github.com/numpy/numpy / setup_method

Method setup_method

numpy/core/tests/test_deprecations.py:35–47  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

33 warning_cls = DeprecationWarning
34
35 def setup_method(self):
36 self.warn_ctx = warnings.catch_warnings(record=True)
37 self.log = self.warn_ctx.__enter__()
38
39 # Do *not* ignore other DeprecationWarnings. Ignoring warnings
40 # can give very confusing results because of
41 # https://bugs.python.org/issue4180 and it is probably simplest to
42 # try to keep the tests cleanly giving only the right warning type.
43 # (While checking them set to "error" those are ignored anyway)
44 # We still have them show up, because otherwise they would be raised
45 warnings.filterwarnings("always", category=self.warning_cls)
46 warnings.filterwarnings("always", message=self.message,
47 category=self.warning_cls)
48
49 def teardown_method(self):
50 self.warn_ctx.__exit__()

Callers 1

Calls 1

__enter__Method · 0.45

Tested by

no test coverage detected