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

Method test_overrides

numpy/distutils/tests/test_system_info.py:271–300  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

269 @pytest.mark.xfail(HAS_MKL, reason=("`[DEFAULT]` override doesn't work if "
270 "numpy is built with MKL support"))
271 def test_overrides(self):
272 previousDir = os.getcwd()
273 cfg = os.path.join(self._dir1, 'site.cfg')
274 shutil.copy(self._sitecfg, cfg)
275 try:
276 os.chdir(self._dir1)
277 # Check that the '[ALL]' section does not override
278 # missing values from other sections
279 info = mkl_info()
280 lib_dirs = info.cp['ALL']['library_dirs'].split(os.pathsep)
281 assert info.get_lib_dirs() != lib_dirs
282
283 # But if we copy the values to a '[mkl]' section the value
284 # is correct
285 with open(cfg) as fid:
286 mkl = fid.read().replace('[ALL]', '[mkl]', 1)
287 with open(cfg, 'w') as fid:
288 fid.write(mkl)
289 info = mkl_info()
290 assert info.get_lib_dirs() == lib_dirs
291
292 # Also, the values will be taken from a section named '[DEFAULT]'
293 with open(cfg) as fid:
294 dflt = fid.read().replace('[mkl]', '[DEFAULT]', 1)
295 with open(cfg, 'w') as fid:
296 fid.write(dflt)
297 info = mkl_info()
298 assert info.get_lib_dirs() == lib_dirs
299 finally:
300 os.chdir(previousDir)
301
302
303def test_distutils_parse_env_order(monkeypatch):

Callers

nothing calls this directly

Calls 9

mkl_infoClass · 0.90
openFunction · 0.85
get_lib_dirsMethod · 0.80
replaceMethod · 0.80
joinMethod · 0.45
copyMethod · 0.45
splitMethod · 0.45
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected