obkit 0.0.3__tar.gz → 0.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: obkit
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Utility toolkit for omnibenchmark modules and Snakemake workflows
5
5
  Author: Omnibenchmark Contributors
6
6
  License: MIT License
@@ -3,6 +3,7 @@ import os
3
3
  import socket
4
4
  import sys
5
5
  from datetime import datetime, timezone
6
+ from pathlib import Path
6
7
 
7
8
  _state = {
8
9
  "log_file": None,
@@ -11,8 +12,8 @@ _state = {
11
12
 
12
13
 
13
14
  def init_logger(path):
14
- if not isinstance(path, str) or not path:
15
- raise ValueError("init_logger(): 'path' must be a non-empty string")
15
+ if not isinstance(path, (str, Path)) or not str(path):
16
+ raise ValueError("init_logger(): 'path' must be a non-empty string or Path")
16
17
  os.makedirs(path, exist_ok=True)
17
18
  log_file = os.path.join(os.path.realpath(path), "obkit-events.jsonl")
18
19
  _state["log_file"] = log_file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: obkit
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Utility toolkit for omnibenchmark modules and Snakemake workflows
5
5
  Author: Omnibenchmark Contributors
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "obkit"
7
- version = "0.0.3"
7
+ version = "0.0.4"
8
8
  description = "Utility toolkit for omnibenchmark modules and Snakemake workflows"
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
@@ -1,5 +1,6 @@
1
1
  import os
2
2
  import tempfile
3
+ from pathlib import Path
3
4
 
4
5
  import pytest
5
6
 
@@ -15,6 +16,15 @@ def test_init_logger_creates_missing_directory_and_returns_log_path():
15
16
  assert os.path.basename(p) == "obkit-events.jsonl"
16
17
 
17
18
 
19
+ def test_init_logger_accepts_path_object():
20
+ with tempfile.TemporaryDirectory() as base:
21
+ d = Path(base) / "path-subdir"
22
+ assert not d.exists()
23
+ p = init_logger(d)
24
+ assert d.is_dir()
25
+ assert os.path.basename(p) == "obkit-events.jsonl"
26
+
27
+
18
28
  def test_init_logger_rejects_bad_input():
19
29
  with pytest.raises((ValueError, TypeError)):
20
30
  init_logger("")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes