aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Weddige <konstantin.weddige@lutrasecurity.com>2022-12-01 11:32:05 +0100
committerKonstantin Weddige <konstantin.weddige@lutrasecurity.com>2022-12-01 11:32:05 +0100
commitafb0fbc0748ead4c8da5b3e29046bb0bd54306f0 (patch)
tree3cec1f4663a1a13930e29af14233843f78f958f5
parent0f7c9d312fbec1edd625c35fec3eab1a9983993a (diff)
downloadabsl-py-afb0fbc0748ead4c8da5b3e29046bb0bd54306f0.tar.gz
Adjust tests and CHANGELOG
-rw-r--r--CHANGELOG.md4
-rw-r--r--absl/logging/tests/logging_test.py6
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'), \