From 1f05674b5bb9bea6fd60adac0cd33e93c268ed04 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Mon, 30 Nov 2020 15:49:30 +0100 Subject: [PATCH] backup: cleanup flake8 nits --- backup/backup.py | 2 -- backup/test_backup.py | 20 +++++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/backup/backup.py b/backup/backup.py index c63afdf..20d062a 100755 --- a/backup/backup.py +++ b/backup/backup.py @@ -245,7 +245,6 @@ class FileBackend(Backend): assert(version == self.version) - def resolve_backend_class(backend_url): backend_map: Mapping[str, Type[Backend]] = { 'file': FileBackend, @@ -353,7 +352,6 @@ def kill(message: str): time.sleep(30) - plugin.add_option( 'backup-destination', None, 'UNUSED. Kept for backward compatibility only. Please update your configuration to remove this option.' diff --git a/backup/test_backup.py b/backup/test_backup.py index 6096702..caca167 100644 --- a/backup/test_backup.py +++ b/backup/test_backup.py @@ -1,8 +1,6 @@ from backup import FileBackend from flaky import flaky -from pyln.client import RpcError -from pyln.testing.fixtures import * -from pyln.client import RpcError +from pyln.testing.fixtures import * # noqa: F401,F403 import os import pytest import subprocess @@ -15,6 +13,7 @@ cli_path = os.path.join(os.path.dirname(__file__), "backup-cli") # For the transition period we require deprecated_apis to be true deprecated_apis = True + def test_start(node_factory, directory): bpath = os.path.join(directory, 'lightning-1', 'regtest') bdest = 'file://' + os.path.join(bpath, 'backup.dbak') @@ -23,7 +22,7 @@ def test_start(node_factory, directory): opts = { 'plugin': plugin_path, 'allow-deprecated-apis': deprecated_apis, - } + } l1 = node_factory.get_node(options=opts, cleandir=False) plugins = [os.path.basename(p['name']) for p in l1.rpc.plugin("list")['plugins']] assert("backup.py" in plugins) @@ -39,7 +38,6 @@ def test_start_no_init(node_factory, directory): """The plugin should refuse to start if we haven't initialized the backup """ bpath = os.path.join(directory, 'lightning-1', 'regtest') - bdest = 'file://' + os.path.join(bpath, 'backup.dbak') os.makedirs(bpath) opts = { 'plugin': plugin_path, @@ -95,7 +93,7 @@ def test_tx_abort(node_factory, directory): opts = { 'plugin': plugin_path, 'allow-deprecated-apis': deprecated_apis, - } + } l1 = node_factory.get_node(options=opts, cleandir=False) l1.stop() @@ -125,10 +123,10 @@ def test_failing_restore(node_factory, directory): opts = { 'plugin': plugin_path, 'allow-deprecated-apis': deprecated_apis, - } + } def section(comment): - print("="*25, comment, "="*25) + print("=" * 25, comment, "=" * 25) section("Starting node for the first time") l1 = node_factory.get_node(options=opts, cleandir=False, may_fail=True) @@ -158,7 +156,7 @@ def test_intermittent_backup(node_factory, directory): opts = { 'plugin': plugin_path, 'allow-deprecated-apis': deprecated_apis, - } + } l1 = node_factory.get_node(options=opts, cleandir=False, may_fail=True) # Now start without the plugin. This should work fine. @@ -184,7 +182,7 @@ def test_restore(node_factory, directory): opts = { 'plugin': plugin_path, 'allow-deprecated-apis': deprecated_apis, - } + } l1 = node_factory.get_node(options=opts, cleandir=False) l1.stop() @@ -200,7 +198,7 @@ def test_restore_dir(node_factory, directory): opts = { 'plugin': plugin_path, 'allow-deprecated-apis': deprecated_apis, - } + } l1 = node_factory.get_node(options=opts, cleandir=False) l1.stop()