Skip to content

Commit c3944fc

Browse files
committed
test: drop FilesystemMockingTestCase in netconfig
1 parent 2196104 commit c3944fc

File tree

3 files changed

+384
-235
lines changed

3 files changed

+384
-235
lines changed

tests/unittests/conftest.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def m_gpg():
3939
("relpath", 1),
4040
],
4141
os: [
42+
("chown", 2),
4243
("listdir", 1),
4344
("mkdir", 1),
4445
("rmdir", 1),
@@ -76,8 +77,18 @@ def m_gpg():
7677

7778

7879
@pytest.fixture
79-
def fake_filesystem(mocker, tmpdir):
80-
"""Mocks fs functions to operate under `tmpdir`"""
80+
def fake_filesystem_hook():
81+
"""A hook to interact with the real filesystem before mocking it in
82+
fake_filesystem"""
83+
84+
85+
@pytest.fixture
86+
def fake_filesystem(mocker, tmpdir, fake_filesystem_hook):
87+
"""Mocks fs functions to operate under `tmpdir`
88+
89+
fix_cloud_init_project_dir requested to sort it before this fixture to
90+
bypass fs faking.
91+
"""
8192
# This allows fake_filesystem to be used with production code that
8293
# creates temporary directories. Functions like TemporaryDirectory()
8394
# attempt to create a directory under "/tmp" assuming that it already

0 commit comments

Comments
 (0)