Skip to content

Commit

Permalink
Pass kwargs along in APIObjectSyncMixin.list() (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtomlinson authored Jan 22, 2025
1 parent 2d066ed commit d19b6c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kr8s/_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,8 @@ def adopt(self, child):
return run_sync(self.async_adopt)(child) # type: ignore

@classmethod
def list(cls):
yield from run_sync(cls.async_list)()
def list(cls, **kwargs):
yield from run_sync(cls.async_list)(**kwargs)


## v1 objects
Expand Down
10 changes: 10 additions & 0 deletions kr8s/tests/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,16 @@ async def test_pod_list():
assert {p.name for p in pods1} == {p.name for p in pods2}


async def test_pod_list_sync():
pods1 = [pod for pod in kr8s.get("pods", namespace=kr8s.ALL)]
pods2 = [pod for pod in SyncPod.list(namespace=kr8s.ALL)]
assert pods1 and pods2
assert len(pods1) == len(pods2)
assert all(isinstance(p, SyncPod) for p in pods1)
assert all(isinstance(p, SyncPod) for p in pods2)
assert {p.name for p in pods1} == {p.name for p in pods2}


@pytest.mark.parametrize(
"ports",
[
Expand Down

0 comments on commit d19b6c1

Please sign in to comment.