Skip to content

Commit 3a0d237

Browse files
authored
fix(BaseClient): prevent raising an error if None is passed to the log_dir
1 parent 34280d0 commit 3a0d237

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
## Unreleased
44

5+
### Fixed
6+
7+
- prevent an exception if the `log_dir` for the `OhsomeClient` was set to `None`
8+
- removed time-dependency of unit tests that would cause them to fail at any time after the cassettes were recorded
9+
510
### Changed
611

712
- relaxed dependency requirement for `urllib3` to >=2.0.2 to prevent ohsome-py from becoming a 'diamond-dependency'
813
- improved and sped up testing (first steps towards [#139](https://github.com/GIScience/ohsome-py/issues/139))
914
- move metadata property from singleton to `chached_property`
1015

11-
### Fixed
12-
13-
- removed time-dependency of unit tests that would cause them to fail at any time after the cassettes were recorded
14-
1516
## 0.3.0
1617

1718
### Added

ohsome/clients.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(
5656
RetryError by the underlying library.
5757
"""
5858
self.log = log
59-
self.log_dir = Path(log_dir)
59+
self.log_dir = Path(log_dir or DEFAULT_LOG_DIR)
6060
if self.log:
6161
self.log_dir.mkdir(parents=True, exist_ok=True)
6262
if base_api_url is not None:

ohsome/test/test_client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import pytest
1212

1313
import ohsome
14+
from ohsome import OhsomeClient
1415
from ohsome.constants import OHSOME_VERSION
1516

1617
script_path = os.path.dirname(os.path.realpath(__file__))
@@ -318,3 +319,15 @@ def test_post_with_endpoint_string(base_client):
318319

319320
assert isinstance(result, gpd.GeoDataFrame)
320321
assert len(result) == 1
322+
323+
324+
def test_none_init():
325+
"""Test if the input parameters can set to None explicitly."""
326+
assert OhsomeClient(
327+
base_api_url=None,
328+
log=None,
329+
log_dir=None,
330+
cache=None,
331+
user_agent=None,
332+
retry=None,
333+
)

0 commit comments

Comments
 (0)