File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ The released versions correspond to PyPI releases.
1212* the default for `FakeFilesystem.shuffle_listdir_results` will change to `True` to reflect
1313 the real filesystem behavior
1414
15+ ## Unreleased
16+
17+ ### Fixes
18+ * fixes a regression that caused unfaked `fcntl` calls to fail (see [#1074](../../issues/1074))
19+
1520## [Version 5.7.0](https://pypi.python.org/pypi/pyfakefs/5.7.0) (2024-08-10)
1621Adds official Python 3.13 support, improves OS emulation behavior.
1722
Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ def lockf(
181181 pass
182182
183183 def __getattribute__ (self , name ):
184- """Forwards any unfaked calls to the standard fcntl module ."""
184+ """Prevents patching of skipped modules ."""
185185 fs : FakeFilesystem = object .__getattribute__ (self , "filesystem" )
186186 fnctl_module = object .__getattribute__ (self , "_fcntl_module" )
187187 if fs .patcher :
@@ -193,3 +193,7 @@ def __getattribute__(self, name):
193193 return getattr (fnctl_module , name )
194194
195195 return object .__getattribute__ (self , name )
196+
197+ def __getattr__ (self , name ):
198+ """Forwards any unfaked calls to the standard fcntl module."""
199+ return getattr (self ._fcntl_module , name )
Original file line number Diff line number Diff line change 1+ # Licensed under the Apache License, Version 2.0 (the "License");
2+ # you may not use this file except in compliance with the License.
3+ # You may obtain a copy of the License at
4+ #
5+ # http://www.apache.org/licenses/LICENSE-2.0
6+ #
7+ # Unless required by applicable law or agreed to in writing, software
8+ # distributed under the License is distributed on an "AS IS" BASIS,
9+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+ # See the License for the specific language governing permissions and
11+ # limitations under the License.
12+
13+ import sys
14+
15+ if sys .platform == "linux" :
16+ import fcntl
17+
18+ def test_unpatched_attributes_are_forwarded_to_real_fs (fs ):
19+ # regression test for #1074
20+ with open ("lock_file" , "a+" ) as lock_file :
21+ fcntl .flock (lock_file , fcntl .LOCK_SH )
22+ fcntl .flock (lock_file , fcntl .LOCK_UN )
You can’t perform that action at this time.
0 commit comments