diff options
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | absl/logging/tests/logging_test.py | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ae82a55..1405a14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com). ## Unreleased -Nothing notable unreleased. +### Changed + +* If no log dir is specified `logging.find_log_dir()` now falls back to `tempfile.gettempdir()` instead of `/tmp/`. ## 1.3.0 (2022-10-11) diff --git a/absl/logging/tests/logging_test.py b/absl/logging/tests/logging_test.py index e5c4fcc..1c337f9 100644 --- a/absl/logging/tests/logging_test.py +++ b/absl/logging/tests/logging_test.py @@ -706,7 +706,7 @@ class LoggingTest(absltest.TestCase): os.path.isdir.return_value = True os.access.return_value = True log_dir = logging.find_log_dir() - self.assertEqual('/tmp/', log_dir) + self.assertEqual(tempfile.gettempdir(), log_dir) @flagsaver.flagsaver(log_dir='') def test_find_log_dir_with_tmp(self): @@ -714,10 +714,10 @@ class LoggingTest(absltest.TestCase): mock.patch.object(os.path, 'exists'), \ mock.patch.object(os.path, 'isdir'): os.path.exists.return_value = False - os.path.isdir.side_effect = lambda path: path == '/tmp/' + os.path.isdir.side_effect = lambda path: path == tempfile.gettempdir() os.access.return_value = True log_dir = logging.find_log_dir() - self.assertEqual('/tmp/', log_dir) + self.assertEqual(tempfile.gettempdir(), log_dir) def test_find_log_dir_with_nothing(self): with mock.patch.object(os.path, 'exists'), \ |