networkd-test.py: hide default .network files

To make the test works fine with -Ddefault-network=True.
This commit is contained in:
Yu Watanabe 2023-11-09 01:58:30 +09:00
parent 93252bfea7
commit 2e978188cb

View file

@ -87,6 +87,12 @@ def setUpModule():
# Ensure the unit directory exists so tests can dump files into it.
os.makedirs(NETWORK_UNITDIR, exist_ok=True)
# mask all default .network files
if os.path.exists('/usr/lib/systemd/network'):
for unit in os.listdir('/usr/lib/systemd/network'):
if unit.endswith('.network'):
os.symlink('/dev/null', os.path.join(NETWORK_UNITDIR, unit))
def tearDownModule():
global tmpmounts