|
9 | 9 | from typing import Any |
10 | 10 |
|
11 | 11 | import pytest |
12 | | -from conftest import cmd, cmd_raises |
| 12 | +from conftest import cmd, cmd_raises, update_env |
13 | 13 |
|
14 | 14 | from west import configuration as config |
15 | 15 | from west.util import PathType |
@@ -232,19 +232,18 @@ def test_local_creation_with_topdir(): |
232 | 232 | # The autouse fixture at the top of this file has set up an |
233 | 233 | # environment variable for our local config file. Disable it |
234 | 234 | # to make sure the API works with a 'real' topdir. |
235 | | - del os.environ['WEST_CONFIG_LOCAL'] |
236 | | - |
237 | | - # We should be able to write into our topdir's config file now. |
238 | | - update_testcfg('pytest', 'key', 'val', configfile=LOCAL, topdir=str(topdir)) |
239 | | - assert not system.exists() |
240 | | - assert not glbl.exists() |
241 | | - assert not local.exists() |
242 | | - assert topdir_config.exists() |
243 | | - |
244 | | - assert cfg(f=ALL, topdir=str(topdir))['pytest']['key'] == 'val' |
245 | | - assert 'pytest' not in cfg(f=SYSTEM) |
246 | | - assert 'pytest' not in cfg(f=GLOBAL) |
247 | | - assert cfg(f=LOCAL, topdir=str(topdir))['pytest']['key'] == 'val' |
| 235 | + with update_env({'WEST_CONFIG_LOCAL': None}): |
| 236 | + # We should be able to write into our topdir's config file now. |
| 237 | + update_testcfg('pytest', 'key', 'val', configfile=LOCAL, topdir=str(topdir)) |
| 238 | + assert not system.exists() |
| 239 | + assert not glbl.exists() |
| 240 | + assert not local.exists() |
| 241 | + assert topdir_config.exists() |
| 242 | + |
| 243 | + assert cfg(f=ALL, topdir=str(topdir))['pytest']['key'] == 'val' |
| 244 | + assert 'pytest' not in cfg(f=SYSTEM) |
| 245 | + assert 'pytest' not in cfg(f=GLOBAL) |
| 246 | + assert cfg(f=LOCAL, topdir=str(topdir))['pytest']['key'] == 'val' |
248 | 247 |
|
249 | 248 |
|
250 | 249 | def test_append(): |
|
0 commit comments