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

Function test_fcompiler_flags

numpy/distutils/tests/test_fcompiler.py:15–42  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

13
14
15def test_fcompiler_flags(monkeypatch):
16 monkeypatch.setenv('NPY_DISTUTILS_APPEND_FLAGS', '0')
17 fc = numpy.distutils.fcompiler.new_fcompiler(compiler='none')
18 flag_vars = fc.flag_vars.clone(lambda *args, **kwargs: None)
19
20 for opt, envvar in customizable_flags:
21 new_flag = '-dummy-{}-flag'.format(opt)
22 prev_flags = getattr(flag_vars, opt)
23
24 monkeypatch.setenv(envvar, new_flag)
25 new_flags = getattr(flag_vars, opt)
26
27 monkeypatch.delenv(envvar)
28 assert_(new_flags == [new_flag])
29
30 monkeypatch.setenv('NPY_DISTUTILS_APPEND_FLAGS', '1')
31
32 for opt, envvar in customizable_flags:
33 new_flag = '-dummy-{}-flag'.format(opt)
34 prev_flags = getattr(flag_vars, opt)
35 monkeypatch.setenv(envvar, new_flag)
36 new_flags = getattr(flag_vars, opt)
37
38 monkeypatch.delenv(envvar)
39 if prev_flags is None:
40 assert_(new_flags == [new_flag])
41 else:
42 assert_(new_flags == prev_flags + [new_flag])
43

Callers

nothing calls this directly

Calls 2

assert_Function · 0.90
cloneMethod · 0.80

Tested by

no test coverage detected