Skip to content

Commit c433585

Browse files
committed
remote/client: Use logging when acquiring / releasing
Use logging rather than print so that this output can be controlled. Signed-off-by: Simon Glass <sjg@chromium.org>
1 parent 6a126b1 commit c433585

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

labgrid/remote/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ async def _acquire_place(self, place):
747747
try:
748748
await self.stub.AcquirePlace(request)
749749
await self.sync_with_coordinator()
750-
print(f"acquired place {place.name}")
750+
logging.info("acquired place %s", place.name)
751751
except grpc.aio.AioRpcError as e:
752752
# check potential failure causes
753753
for exporter, groups in sorted(self.resources.items()):
@@ -805,7 +805,7 @@ async def _release_place(self, place):
805805
except grpc.aio.AioRpcError as e:
806806
raise ServerError(e.details())
807807

808-
print(f"released place {place.name}")
808+
logging.info("released place %s", place.name)
809809

810810
async def release_from(self):
811811
"""Release a place, but only if acquired by a specific user"""

tests/test_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def test_place_acquire_enforce(place):
217217
spawn.close()
218218
assert spawn.exitstatus != 0, spawn.before.strip()
219219

220-
with pexpect.spawn('python -m labgrid.remote.client -p test acquire --allow-unmatched') as spawn:
220+
with pexpect.spawn('python -m labgrid.remote.client -v -p test acquire --allow-unmatched') as spawn:
221221
spawn.expect("acquired place test")
222222
spawn.expect(pexpect.EOF)
223223
spawn.close()
@@ -577,13 +577,13 @@ def test_reservation_custom_config(place, exporter, tmpdir):
577577
env = os.environ.copy()
578578
env['LG_TOKEN'] = token.decode('ASCII')
579579

580-
with pexpect.spawn(f'python -m labgrid.remote.client -c {p} -p + lock', env=env) as spawn:
580+
with pexpect.spawn(f'python -m labgrid.remote.client -v -c {p} -p + lock', env=env) as spawn:
581581
spawn.expect("acquired place test")
582582
spawn.expect(pexpect.EOF)
583583
spawn.close()
584584
assert spawn.exitstatus == 0, spawn.before.strip()
585585

586-
with pexpect.spawn(f'python -m labgrid.remote.client -c {p} -p + release', env=env) as spawn:
586+
with pexpect.spawn(f'python -m labgrid.remote.client -v -c {p} -p + release', env=env) as spawn:
587587
spawn.expect("released place test")
588588
spawn.expect(pexpect.EOF)
589589
spawn.close()

0 commit comments

Comments
 (0)