Skip to content

Commit b17113d

Browse files
authored
fix: json should support Path (#1026)
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 38dea06 commit b17113d

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

nox/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def _produce_json_listing(manifest: Manifest, global_config: Namespace) -> None:
314314
"call_spec": getattr(session.func, "call_spec", {}),
315315
}
316316
)
317-
print(json.dumps(report))
317+
print(json.dumps(report, default=str))
318318

319319

320320
def honor_list_request(manifest: Manifest, global_config: Namespace) -> Manifest | int:

tests/test_tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import os
2222
import platform
2323
import typing
24+
from pathlib import Path
2425
from textwrap import dedent
2526
from unittest import mock
2627

@@ -33,7 +34,6 @@
3334

3435
if typing.TYPE_CHECKING:
3536
from collections.abc import Callable, Generator
36-
from pathlib import Path
3737
from types import ModuleType
3838

3939
RESOURCES = os.path.join(os.path.dirname(__file__), "resources")
@@ -531,7 +531,7 @@ def test_honor_list_json_request(capsys: pytest.CaptureFixture[builtins.str]) ->
531531
name="bar",
532532
friendly_name="foo",
533533
description="simple",
534-
func=argparse.Namespace(python="123"),
534+
func=argparse.Namespace(python=Path("123")),
535535
tags=[],
536536
),
537537
True,

0 commit comments

Comments
 (0)