We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
tests/test_logger.py
pyfakefs
1 parent f531be6 commit 1d68fbdCopy full SHA for 1d68fbd
1 file changed
tests/test_logger.py
@@ -10,8 +10,16 @@
10
from xcp.logger import openLog
11
12
13
-def test_openLog_mock_open():
14
- """Cover xcp.logger.openLog.open_with_codec_handling and check the arguments used for open()"""
+def test_openLog_mock_open(fs):
+ # type(FakeFilesystem) -> None
15
+ """
16
+ - Covers xcp.logger.openLog.open_with_codec_handling and
17
+ - checks the arguments it uses for open()
18
+
19
+ Because needs to call openLog() which creates a logfile, this test uses
20
+ the pytest pyfakefs fixture 'fs' which wraps creating it in a virtual fs.
21
+ With it, this tests does not create a log file on the filesystem of the host.
22
23
fh = StringIO()
24
with patch("xcp.compat.open", mock_open()) as open_mock:
25
open_mock.return_value = fh
0 commit comments