|
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 |
@@ -213,19 +213,18 @@ def test_local_creation_with_topdir(): |
213 | 213 | # The autouse fixture at the top of this file has set up an |
214 | 214 | # environment variable for our local config file. Disable it |
215 | 215 | # to make sure the API works with a 'real' topdir. |
216 | | - del os.environ['WEST_CONFIG_LOCAL'] |
217 | | - |
218 | | - # We should be able to write into our topdir's config file now. |
219 | | - update_testcfg('pytest', 'key', 'val', configfile=LOCAL, topdir=str(topdir)) |
220 | | - assert not system.exists() |
221 | | - assert not glbl.exists() |
222 | | - assert not local.exists() |
223 | | - assert topdir_config.exists() |
224 | | - |
225 | | - assert cfg(f=ALL, topdir=str(topdir))['pytest']['key'] == 'val' |
226 | | - assert 'pytest' not in cfg(f=SYSTEM) |
227 | | - assert 'pytest' not in cfg(f=GLOBAL) |
228 | | - assert cfg(f=LOCAL, topdir=str(topdir))['pytest']['key'] == 'val' |
| 216 | + with update_env({'WEST_CONFIG_LOCAL':None}): |
| 217 | + # We should be able to write into our topdir's config file now. |
| 218 | + update_testcfg('pytest', 'key', 'val', configfile=LOCAL, topdir=str(topdir)) |
| 219 | + assert not system.exists() |
| 220 | + assert not glbl.exists() |
| 221 | + assert not local.exists() |
| 222 | + assert topdir_config.exists() |
| 223 | + |
| 224 | + assert cfg(f=ALL, topdir=str(topdir))['pytest']['key'] == 'val' |
| 225 | + assert 'pytest' not in cfg(f=SYSTEM) |
| 226 | + assert 'pytest' not in cfg(f=GLOBAL) |
| 227 | + assert cfg(f=LOCAL, topdir=str(topdir))['pytest']['key'] == 'val' |
229 | 228 |
|
230 | 229 | def test_append(): |
231 | 230 | update_testcfg('pytest', 'key', 'system', configfile=SYSTEM) |
|
0 commit comments