Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ The released versions correspond to PyPI releases.
* Some public constants in `fake_filesystem` that had been moved to `helpers` are
made accessible from there again (see [#809](../../issues/809)).
* Add missing fake implementations for `os.getuid` and `os.getgid` (Posix only)
* Make sure a `/tmp` path exists under linux (`TMPDIR` may point elsewhere)
(see [#810](../../issues/810))


## [Version 5.2.1](https://pypi.python.org/pypi/pyfakefs/5.2.1) (2023-04-11)
Expand Down
8 changes: 6 additions & 2 deletions docs/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,12 @@ directory named ``/tmp`` when running on Linux or Unix systems,
# the temp directory is always present at test start
assert len(os.listdir("/")) == 1

Under macOS, a symlink to the actual temp directory is created additionally as `/tmp`
in the fake filesystem.
Under macOS and linux, if the actual temp path is not `/tmp` (which is always the case
under macOS), a symlink to the actual temp directory is additionally created as `/tmp`
in the fake filesystem. Note that the file size of this link is ignored while
calculating the fake filesystem size, so that the used size with an otherwise empty
fake filesystem can always be assumed to be 0.


User rights
-----------
Expand Down
4 changes: 2 additions & 2 deletions pyfakefs/fake_filesystem_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,8 @@ def setUp(self, doctester: Any = None) -> None:
# so we create it here for convenience
assert self.fs is not None
self.fs.create_dir(temp_dir)
if sys.platform == "darwin" and not self.fs.exists("/tmp"):
# under macOS, we also create a link in /tmp for convenience
if sys.platform != "win32" and not self.fs.exists("/tmp"):
# under Posix, we also create a link in /tmp if the path does not exist
self.fs.create_symlink("/tmp", temp_dir)
# reset the used size to 0 to avoid having the link size counted
# which would make disk size tests more complicated
Expand Down
2 changes: 1 addition & 1 deletion pyfakefs/tests/fake_filesystem_unittest_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def testTempDirExists(self):

@unittest.skipIf(sys.platform == "win32", "POSIX only test")
def testTmpExists(self):
# directory under Linux, link under macOS
# directory or link under Linux, link under macOS
self.assertTrue(os.path.exists("/tmp"))


Expand Down