Skip to content

Commit bf6c03d

Browse files
committed
tests: apply ruff format
Now that we have lints passing, add a basic ruff.toml configuration, and reformat accordingly. We leave the quote-style as-is, but may unify this later. Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
1 parent 9bd71ce commit bf6c03d

7 files changed

Lines changed: 511 additions & 275 deletions

File tree

tests/conftest.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
21
import pytest
32
import asyncdbus
43
import trio.testing
54

65
import mctpenv
76

7+
88
@pytest.fixture
99
async def sysnet():
1010
"""Simple system & network.
@@ -14,34 +14,40 @@ async def sysnet():
1414
"""
1515
return await mctpenv.default_sysnet()
1616

17+
1718
@pytest.fixture
1819
async def dbus():
1920
async with asyncdbus.MessageBus().connect() as bus:
2021
yield bus
2122

23+
2224
@pytest.fixture
2325
def config():
2426
return None
2527

28+
2629
@pytest.fixture
2730
async def mctpd(nursery, dbus, sysnet, config):
28-
m = mctpenv.MctpdWrapper(dbus, sysnet, config = config)
31+
m = mctpenv.MctpdWrapper(dbus, sysnet, config=config)
2932
await m.start_mctpd(nursery)
3033
yield m
3134
res = await m.stop_mctpd()
3235
assert res == 0
3336

37+
3438
@pytest.fixture
3539
async def mctp(nursery, sysnet):
3640
return mctpenv.MctpWrapper(nursery, sysnet)
3741

42+
3843
@pytest.fixture
3944
def autojump_clock():
4045
"""
4146
Custom autojump clock with a reasonable threshold for non-time I/O waits
4247
"""
4348
return trio.testing.MockClock(autojump_threshold=0.01)
4449

50+
4551
@pytest.fixture
4652
async def routed_ep(mctpd):
4753
"""
@@ -52,7 +58,7 @@ async def routed_ep(mctpd):
5258
iface = mctpd.system.interfaces[0]
5359

5460
ep.eid = 9
55-
route = mctpd.system.Route(ep.eid, 1, iface = iface)
61+
route = mctpd.system.Route(ep.eid, 1, iface=iface)
5662
neigh = mctpd.system.Neighbour(iface, ep.lladdr, ep.eid)
5763
await mctpd.system.add_route(route)
5864
await mctpd.system.add_neighbour(neigh)

tests/mctp_test_utils.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,53 @@
11
async def mctpd_mctp_base_iface_obj(dbus):
22
obj = await dbus.get_proxy_object(
3-
'au.com.codeconstruct.MCTP1',
4-
'/au/com/codeconstruct/mctp1'
5-
)
3+
'au.com.codeconstruct.MCTP1', '/au/com/codeconstruct/mctp1'
4+
)
65
return await obj.get_interface('au.com.codeconstruct.MCTP1')
76

7+
88
async def mctpd_mctp_iface_obj(dbus, iface):
99
obj = await dbus.get_proxy_object(
10-
'au.com.codeconstruct.MCTP1',
11-
'/au/com/codeconstruct/mctp1/interfaces/' + iface.name
12-
)
10+
'au.com.codeconstruct.MCTP1',
11+
'/au/com/codeconstruct/mctp1/interfaces/' + iface.name,
12+
)
1313
return await obj.get_interface('au.com.codeconstruct.MCTP.BusOwner1')
1414

15+
1516
async def mctpd_mctp_iface_control_obj(dbus, iface):
1617
obj = await dbus.get_proxy_object(
17-
"au.com.codeconstruct.MCTP1",
18-
"/au/com/codeconstruct/mctp1/interfaces/" + iface.name,
19-
)
18+
"au.com.codeconstruct.MCTP1",
19+
"/au/com/codeconstruct/mctp1/interfaces/" + iface.name,
20+
)
2021
return await obj.get_interface("au.com.codeconstruct.MCTP.Interface1")
2122

23+
2224
async def mctpd_mctp_endpoint_obj(dbus, path, iface):
2325
obj = await dbus.get_proxy_object(
24-
'au.com.codeconstruct.MCTP1',
25-
path,
26-
)
26+
'au.com.codeconstruct.MCTP1',
27+
path,
28+
)
2729
return await obj.get_interface(iface)
2830

31+
2932
async def mctpd_mctp_network_obj(dbus, net):
3033
obj = await dbus.get_proxy_object(
31-
'au.com.codeconstruct.MCTP1',
32-
f'/au/com/codeconstruct/mctp1/networks/{net:d}'
33-
)
34+
'au.com.codeconstruct.MCTP1',
35+
f'/au/com/codeconstruct/mctp1/networks/{net:d}',
36+
)
3437
iface = await obj.get_interface('au.com.codeconstruct.MCTP.Network1')
3538
# fixup autogenerated snake-case names
3639
iface.get_local_eids = iface.get_local_ei_ds
3740
iface.set_local_eids = iface.set_local_ei_ds
3841
return iface
3942

43+
4044
async def mctpd_mctp_endpoint_control_obj(dbus, path):
4145
return await mctpd_mctp_endpoint_obj(
42-
dbus,
43-
path,
44-
'au.com.codeconstruct.MCTP.Endpoint1'
45-
)
46+
dbus, path, 'au.com.codeconstruct.MCTP.Endpoint1'
47+
)
48+
4649

4750
async def mctpd_mctp_endpoint_common_obj(dbus, path):
4851
return await mctpd_mctp_endpoint_obj(
49-
dbus,
50-
path,
51-
'xyz.openbmc_project.MCTP.Endpoint'
52-
)
52+
dbus, path, 'xyz.openbmc_project.MCTP.Endpoint'
53+
)

0 commit comments

Comments
 (0)