`os.mkfifo` is not supported
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start in fake_os.py at FakeOsModule and compare the existing os.pipe() handling. Resolve whether mkfifo should only create a filesystem entry or use a FakeFIFO object with distinct open/read/write behavior; done means Unix-only os.mkfifo support without creating a real FIFO, including the documented options and errors.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
No implementation for os.mkfifo() (Unix only).
Describe the solution you'd like
Add implementation so that real FIFOs don't get created in the filesystem.
Describe alternatives you've considered
Currently requires additional mocking.
Need to add something like the following to FakeOsModule in fake_os.py:
def mkfifo(
self,
path: AnyStr,
mode: int = PERM_DEF_FILE,
*,
dir_fd: Optional[int] = None,
) -> None:
"""Create a FIFO (a named pipe) named 'path'.
Args:
path: (str) Name of the file to create.
mode: (int) Permissions to use and type of file to be created.
Default permissions are 0o666. The umask is applied to this
mode.
dir_fd: If not `None`, the file descriptor of a directory,
with `path` being relative to this directory.
Raises:
OSError: If called with unsupported options or the file can not be
created.
"""
if self.filesystem.is_windows_fs:
raise AttributeError("module 'os' has no attribute 'mkfifo'")
path = self._path_with_dir_fd(path, self.mkfifo, dir_fd)
head, tail = self.path.split(path)
if not tail:
if self.filesystem.exists(head, check_link=True):
self.filesystem.raise_os_error(errno.EEXIST, path)
self.filesystem.raise_os_error(errno.ENOENT, path)
if tail in (matching_string(tail, "."), matching_string(tail, "..")):
self.filesystem.raise_os_error(errno.ENOENT, path)
if self.filesystem.exists(path, check_link=True):
self.filesystem.raise_os_error(errno.EEXIST, path)
self.filesystem.add_object(
head,
FakeFile(tail, mode & ~self.filesystem.umask, filesystem=self.filesystem),
)
However, in using a regular file object in the example above, this doesn't simulate the semantics of a FIFO. Could also take inspiration from os.pipe(), except os.mkfifo() doesn't actually open fds, it just creates the entry in the filesystem - maybe create a FakeFIFO object in the filesystem which would then presumably need to handle open/read/write differently.
- Dominant language
- Python
- Stars
- 756
- Forks
- 111
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 10
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pytest-dev/pyfakefs
-
`patched_packages.py` fail: `AttributeError: module 'django' has no attribute 'conf'`Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
pytest-dev/pyfakefs#1367 · 1 comment ·
Maintainers usually reply within 2 days
-
Real Path objects keep a lowercased _str_normcase after a fake filesystem session on Python 3.14Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 58/100
pytest-dev/pyfakefs#1359 · 1 comment ·
Maintainers usually reply within 2 days
-
fnmatch.filter and glob don't match uppercase names under Windows simulationPossibly taken @sricharanreddycheruku claimed this 27 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
pytest-dev/pyfakefs#1345 · 4 comments ·
Maintainers usually reply within 2 days
-
`Path` is replaced with `FakePathlibPathModule` instead of `FakePath` when imported directlyPossibly taken @sunxiuguo claimed this 19 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 70/100
pytest-dev/pyfakefs#1334 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
pytest-dev/pyfakefs#1321 · 4 comments ·
Maintainers usually reply within 2 days
All issues in pytest-dev/pyfakefs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
unionai-oss/pandera#2640 ·
Maintainers usually reply within 2 days
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JdeRobot/RoboticsInfrastructure#843 ·
Maintainers usually reply within 1 day
-
automated endpoint-dead needs-curation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
almanac-data/climate-almanac#122 ·
Maintainers usually reply within 1 day
-
area:harness enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
evarness-ai/iris-harness#420 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
suitenumerique/find#206 ·
Maintainers usually reply within 2 days