Skip to content

Commit 545d240

Browse files
remote/client: provide default for ClientSession.env to make it optional
The Environment was always optional. Before users of ClientSession had to pass an explicit None for this attribute. While we're changing the ClientSession for gRPC anyway, let's make env really optional. This again allows us to make start_session()'s extra argument optional, too. It is used to pass extra arguments to the ClientSession, which means it can be an empty dictionary now. Signed-off-by: Bastian Krause <[email protected]>
1 parent 0e1e4fb commit 545d240

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

labgrid/remote/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ClientSession:
7171

7272
address = attr.ib(validator=attr.validators.instance_of(str))
7373
loop = attr.ib(validator=attr.validators.instance_of(asyncio.BaseEventLoop))
74-
env = attr.ib(validator=attr.validators.optional(attr.validators.instance_of(Environment)))
74+
env = attr.ib(default=None, validator=attr.validators.optional(attr.validators.instance_of(Environment)))
7575
role = attr.ib(default=None, validator=attr.validators.optional(attr.validators.instance_of(str)))
7676
prog = attr.ib(default=None, validator=attr.validators.optional(attr.validators.instance_of(str)))
7777
args = attr.ib(default=None, validator=attr.validators.optional(attr.validators.instance_of(argparse.Namespace)))
@@ -1566,9 +1566,12 @@ def ensure_event_loop(external_loop=None):
15661566
return loop
15671567

15681568

1569-
def start_session(address, extra, debug=False, loop=None):
1569+
def start_session(address, extra=None, debug=False, loop=None):
15701570
loop = ensure_event_loop(loop)
15711571

1572+
if extra is None:
1573+
extra = {}
1574+
15721575
if debug:
15731576
loop.set_debug(True)
15741577

0 commit comments

Comments
 (0)