@@ -0,0 +1,1521 @@
+from __future__ import division, absolute_import, print_function%0A%0Afrom numpy.testing import assert_%0Aimport numpy.distutils.fcompiler%0Aimport os%0A%0Acustomizable_flags = %5B%0A    ('f77', 'F77FLAGS'),%0A    ('f90', 'F90FLAGS'),%0A    ('free', 'FREEFLAGS'),%0A    ('arch', 'FARCH'),%0A    ('debug', 'FDEBUG'),%0A    ('flags', 'FFLAGS'),%0A    ('linker_so', 'LDFLAGS'),%0A%5D%0A%0A%0Adef test_fcompiler_flags_override(monkeypatch):%0A    monkeypatch.setitem(os.environ, 'NPY_DISTUTILS_APPEND_FLAGS', '0')%0A    fc = numpy.distutils.fcompiler.new_fcompiler(compiler='none')%0A    flag_vars = fc.flag_vars.clone(lambda *args, **kwargs: None)%0A%0A    for opt, envvar in customizable_flags:%0A        new_flag = '-dummy-%7B%7D-flag'.format(opt)%0A        prev_flags = getattr(flag_vars, opt)%0A%0A        monkeypatch.setitem(os.environ, envvar, new_flag)%0A        new_flags = getattr(flag_vars, opt)%0A        assert_(new_flags == %5Bnew_flag%5D)%0A%0A%0Adef test_fcompiler_flags_append(monkeypatch):%0A    monkeypatch.setitem(os.environ, 'NPY_DISTUTILS_APPEND_FLAGS', '1')%0A    fc = numpy.distutils.fcompiler.new_fcompiler(compiler='none')%0A    flag_vars = fc.flag_vars.clone(lambda *args, **kwargs: None)%0A%0A    for opt, envvar in customizable_flags:%0A        new_flag = '-dummy-%7B%7D-flag'.format(opt)%0A        prev_flags = getattr(flag_vars, opt)%0A%0A        monkeypatch.setitem(os.environ, envvar, new_flag)%0A        new_flags = getattr(flag_vars, opt)%0A        if prev_flags is None:%0A            assert_(new_flags == %5Bnew_flag%5D)%0A        else:%0A            assert_(new_flags == prev_flags + %5Bnew_flag%5D)%0A%0A

Test distutils flags appending