@@ -38,6 +38,8 @@ def fake_open(file, mode="r", *args, **kwargs):
3838 return io .BytesIO ()
3939 elif "r" in mode :
4040 return io .BytesIO (b"fake zip content" )
41+ if isinstance (file , str ) and file .startswith ("/dev/pts/" ):
42+ return io .BytesIO () if "b" in mode else io .StringIO ()
4143 return original_open (file , mode , * args , ** kwargs )
4244
4345 # Mock file system and subprocess operations
@@ -86,6 +88,8 @@ def fake_open(file, mode="r", *args, **kwargs):
8688 import io
8789
8890 return io .BytesIO ()
91+ if isinstance (file , str ) and file .startswith ("/dev/pts/" ):
92+ return io .BytesIO () if "b" in mode else io .StringIO ()
8993 return original_open (file , mode , * args , ** kwargs )
9094
9195 monkeypatch .setattr ("builtins.open" , fake_open )
@@ -138,6 +142,8 @@ def fake_open(file, mode="r", *args, **kwargs):
138142 import io
139143
140144 return io .BytesIO ()
145+ if isinstance (file , str ) and file .startswith ("/dev/pts/" ):
146+ return io .BytesIO () if "b" in mode else io .StringIO ()
141147 return original_open (file , mode , * args , ** kwargs )
142148
143149 monkeypatch .setattr ("builtins.open" , fake_open )
0 commit comments