Refine Python CI

Add lint environment to `deltachat-rpc-client/`
and set line length to 120, same as in `python/`.

Switch from flake8 to ruff.

Fix ruff warnings.
This commit is contained in:
link2xt
2023-01-19 00:31:39 +00:00
parent ef6f252842
commit fac7b064b4
41 changed files with 312 additions and 345 deletions

View File

@@ -34,8 +34,10 @@ class GroupTrackingPlugin:
def ac_member_added(self, chat, contact, actor, message):
print(
"ac_member_added {} to chat {} from {}".format(
contact.addr, chat.id, actor or message.get_sender_contact().addr
)
contact.addr,
chat.id,
actor or message.get_sender_contact().addr,
),
)
for member in chat.get_contacts():
print("chat member: {}".format(member.addr))
@@ -44,8 +46,10 @@ class GroupTrackingPlugin:
def ac_member_removed(self, chat, contact, actor, message):
print(
"ac_member_removed {} from chat {} by {}".format(
contact.addr, chat.id, actor or message.get_sender_contact().addr
)
contact.addr,
chat.id,
actor or message.get_sender_contact().addr,
),
)

View File

@@ -13,8 +13,8 @@ def datadir():
datadir = path.join("test-data")
if datadir.isdir():
return datadir
else:
pytest.skip("test-data directory not found")
pytest.skip("test-data directory not found")
return None
def test_echo_quit_plugin(acfactory, lp):
@@ -47,7 +47,7 @@ def test_group_tracking_plugin(acfactory, lp):
botproc.fnmatch_lines(
"""
*ac_configure_completed*
"""
""",
)
ac1.add_account_plugin(FFIEventLogger(ac1))
ac2.add_account_plugin(FFIEventLogger(ac2))
@@ -61,7 +61,7 @@ def test_group_tracking_plugin(acfactory, lp):
botproc.fnmatch_lines(
"""
*ac_chat_modified*bot test group*
"""
""",
)
lp.sec("adding third member {}".format(ac2.get_config("addr")))
@@ -76,8 +76,9 @@ def test_group_tracking_plugin(acfactory, lp):
"""
*ac_member_added {}*from*{}*
""".format(
contact3.addr, ac1.get_config("addr")
)
contact3.addr,
ac1.get_config("addr"),
),
)
lp.sec("contact successfully added, now removing")
@@ -86,6 +87,7 @@ def test_group_tracking_plugin(acfactory, lp):
"""
*ac_member_removed {}*from*{}*
""".format(
contact3.addr, ac1.get_config("addr")
)
contact3.addr,
ac1.get_config("addr"),
),
)