Comments (4)
Not really. The problem is the mixture of faked on non-faked calls, e.g. the usage of faked descriptors in the real fs and vice verse. Even if you would map this into the fake fs, the returned descriptors would still be from the real fs (due to the C calls), which do not exist in the fake fs (or if they do exist, they point to something else, which could lead to all kinds of undefined behavior).
Sometimes it makes sense to pause patching in a test, execute something in the real fs, and resume patching again, but this won't work in this case.
It could be possible to write a fake version of posixshmem
and patch the usage accordingly, but I think this wouldn't work either because of other problems in multiprocessing
. The biggest problem is probably that the fake fs will not work in spawed processes in principle - and as these are the point of multiprocessing
, I see no real way to fix this - sorry!
from pyfakefs.
Unfortunately, this won't work, at least not out of the box, due to the limitations of pyfakefs
. Multiprocessing is one of the modules not playing nice with pyfakefs
due to the use of system C functions to access the file system. In this case, it uses posixshmem
, which is a C module, to access the shared memory. This will work in the real filesystem, so either the file is not found, or if the file exists there, a real file descriptor is returned, which is not found in the fake filesystem.
I could not reproduce the inifinite loop so far, but I got another error related to the mentioned problem. Currently, I don't have a solution for this (other than patching it away).
from pyfakefs.
Thanks for having a look.
Is there a way to allow this to pass through to the real filesystem? I tried self.fs.add_real_directory("/dev/shm/",read_only=False)
which did not help.
It looks like the point in resource_tracker.py
where this fails is with a pipe in a spawned process.
from pyfakefs.
I'm moving this to the "limitations" discussions, as there is nothing we can do here, as far as I cn see.
from pyfakefs.
Related Issues (20)
- `PureWindowsPath.stem` changes behavior when `fs` fixture is loaded HOT 14
- `FileExistsError` raised when running test suite in parallel HOT 3
- additional_skip_names is ignored for Path().open HOT 2
- Python 3.13.0 beta 1 crashes HOT 4
- 5.5.0: `pyupgrade --py38-plus` generated patch cause pytest fails HOT 8
- Path.exists is not patched HOT 7
- additional_skip_names are not respected everywhere in pathlib HOT 4
- Patched `os.symlink` mishandles directory descriptors HOT 3
- Missing mock of `os.dup` HOT 4
- `os.getxattr` should raise `OSError(ENODATA)` for non-existent extended attributes HOT 1
- Patched `os.open` does not respect `O_NOFOLLOW` HOT 1
- Faked `os.link` is missing the `follow_symlinks` parameter HOT 1
- Fake `os.open` does not handle the `O_DIRECTORY` flag
- shutil.rmtree failing in OSType.WINDOWS with PermissionError HOT 2
- `os.open(O_DIRECTORY)` should raise `ENOENT` when the file does not exist
- Faked `os.makedirs` differs from the built-in `os.makedirs` and `mkdir -p` HOT 5
- Closing a duplicated fileno invalidates the previous file description
- Do not use scandir package HOT 16
- OSError opening same fd twice HOT 7
- `os.mkfifo` is not supported HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyfakefs.