| 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 | |
| 303 | def test_distutils_parse_env_order(monkeypatch): |