Skip to content

Commit

Permalink
Adjust tests and CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
weddige committed Dec 1, 2022
1 parent 0f7c9d3 commit afb0fbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions absl/logging/tests/logging_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,18 +706,18 @@ def test_find_log_dir_with_hda_tmp(self):
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):
with mock.patch.object(os, 'access'), \
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'), \
Expand Down

0 comments on commit afb0fbc

Please sign in to comment.