From 659ffb0a4ebe9e516568bd5d914e7f1f47513dff Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Thu, 27 Dec 2018 23:32:09 -0800 Subject: TST: suppress test warnings for appending flag behavior better. --- numpy/distutils/tests/test_fcompiler.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'numpy/distutils/tests') diff --git a/numpy/distutils/tests/test_fcompiler.py b/numpy/distutils/tests/test_fcompiler.py index f83b0a13b..ba19a97ea 100644 --- a/numpy/distutils/tests/test_fcompiler.py +++ b/numpy/distutils/tests/test_fcompiler.py @@ -52,8 +52,10 @@ def test_fcompiler_flags_append_warning(monkeypatch): # non-empty flags to start with (otherwise the "if var and append" check # will always be false). try: - fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu95') - fc.customize() + with suppress_warnings() as sup: + sup.record() + fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu95') + fc.customize() except numpy.distutils.fcompiler.CompilerNotFound: pytest.skip("gfortran not found, so can't execute this test") @@ -62,7 +64,10 @@ def test_fcompiler_flags_append_warning(monkeypatch): for opt, envvar in customizable_flags: new_flag = '-dummy-{}-flag'.format(opt) - prev_flags = getattr(fc.flag_vars, opt) + with suppress_warnings() as sup: + sup.record() + prev_flags = getattr(fc.flag_vars, opt) + monkeypatch.setenv(envvar, new_flag) with suppress_warnings() as sup: sup.record() -- cgit v1.2.1