diff --git a/swh/objstorage/tests/test_multiplexer_filter.py b/swh/objstorage/tests/test_multiplexer_filter.py --- a/swh/objstorage/tests/test_multiplexer_filter.py +++ b/swh/objstorage/tests/test_multiplexer_filter.py @@ -108,7 +108,8 @@ # Make the storage filtered self.sconf = { "cls": "pathslicing", - "args": {"root": self.tmpdir, "slicing": "0:5"}, + "root": self.tmpdir, + "slicing": "0:5", } storage = get_objstorage(**self.sconf) self.base_storage = storage @@ -315,7 +316,8 @@ def filter_storage(self, sconf): return get_objstorage( "filtered", - {"storage_conf": sconf, "filters_conf": [id_prefix(self.prefix)]}, + storage_conf=sconf, + filters_conf=[id_prefix(self.prefix)], ) @@ -326,5 +328,5 @@ def filter_storage(self, sconf): return get_objstorage( - "filtered", {"storage_conf": sconf, "filters_conf": [id_regex(self.regex)]} + "filtered", storage_conf=sconf, filters_conf=[id_regex(self.regex)] ) diff --git a/swh/objstorage/tests/test_objstorage_api.py b/swh/objstorage/tests/test_objstorage_api.py --- a/swh/objstorage/tests/test_objstorage_api.py +++ b/swh/objstorage/tests/test_objstorage_api.py @@ -32,7 +32,7 @@ self.app = app super().setUp() - self.storage = get_objstorage("remote", {"url": self.url()}) + self.storage = get_objstorage("remote", url=self.url()) def tearDown(self): super().tearDown() diff --git a/swh/objstorage/tests/test_objstorage_azure.py b/swh/objstorage/tests/test_objstorage_azure.py --- a/swh/objstorage/tests/test_objstorage_azure.py +++ b/swh/objstorage/tests/test_objstorage_azure.py @@ -142,10 +142,8 @@ self.storage = get_objstorage( "azure", - { - "container_url": "https://bogus-container-url.example", - "compression": self.compression, - }, + container_url="https://bogus-container-url.example", + compression=self.compression, ) def test_compression(self): @@ -217,20 +215,20 @@ for prefix in "0123456789abcdef": self.accounts[prefix] = "https://bogus-container-url.example/" + prefix - self.storage = get_objstorage("azure-prefixed", {"accounts": self.accounts}) + self.storage = get_objstorage("azure-prefixed", accounts=self.accounts) def test_prefixedazure_instantiation_missing_prefixes(self): del self.accounts["d"] del self.accounts["e"] with self.assertRaisesRegex(ValueError, "Missing prefixes"): - get_objstorage("azure-prefixed", {"accounts": self.accounts}) + get_objstorage("azure-prefixed", accounts=self.accounts) def test_prefixedazure_instantiation_inconsistent_prefixes(self): self.accounts["00"] = self.accounts["0"] with self.assertRaisesRegex(ValueError, "Inconsistent prefixes"): - get_objstorage("azure-prefixed", {"accounts": self.accounts}) + get_objstorage("azure-prefixed", accounts=self.accounts) def test_prefixedazure_sharding_behavior(self): for i in range(100): @@ -285,11 +283,9 @@ with pytest.deprecated_call(): objs = get_objstorage( "azure", - { - "account_name": "account_name", - "api_secret_key": base64.b64encode(b"account_key"), - "container_name": "container_name", - }, + account_name="account_name", + api_secret_key=base64.b64encode(b"account_key"), + container_name="container_name", ) assert objs is not None @@ -312,6 +308,6 @@ } with pytest.deprecated_call(): - objs = get_objstorage("azure-prefixed", {"accounts": accounts}) + objs = get_objstorage("azure-prefixed", accounts=accounts) assert objs is not None diff --git a/swh/objstorage/tests/test_objstorage_in_memory.py b/swh/objstorage/tests/test_objstorage_in_memory.py --- a/swh/objstorage/tests/test_objstorage_in_memory.py +++ b/swh/objstorage/tests/test_objstorage_in_memory.py @@ -13,4 +13,4 @@ class TestInMemoryObjStorage(ObjStorageTestFixture, unittest.TestCase): def setUp(self): super().setUp() - self.storage = get_objstorage(cls="memory", args={}) + self.storage = get_objstorage(cls="memory") diff --git a/swh/objstorage/tests/test_objstorage_instantiation.py b/swh/objstorage/tests/test_objstorage_instantiation.py --- a/swh/objstorage/tests/test_objstorage_instantiation.py +++ b/swh/objstorage/tests/test_objstorage_instantiation.py @@ -30,11 +30,11 @@ shutil.rmtree(self.path2) def test_pathslicing_objstorage(self): - conf = {"cls": "pathslicing", "args": {"root": self.path, "slicing": "0:2/0:5"}} + conf = {"cls": "pathslicing", "root": self.path, "slicing": "0:2/0:5"} st = get_objstorage(**conf) self.assertTrue(isinstance(st, PathSlicingObjStorage)) def test_remote_objstorage(self): - conf = {"cls": "remote", "args": {"url": "http://127.0.0.1:4242/"}} + conf = {"cls": "remote", "url": "http://127.0.0.1:4242/"} st = get_objstorage(**conf) self.assertTrue(isinstance(st, RemoteObjStorage)) diff --git a/swh/objstorage/tests/test_objstorage_pathslicing.py b/swh/objstorage/tests/test_objstorage_pathslicing.py --- a/swh/objstorage/tests/test_objstorage_pathslicing.py +++ b/swh/objstorage/tests/test_objstorage_pathslicing.py @@ -25,11 +25,9 @@ self.tmpdir = tempfile.mkdtemp() self.storage = get_objstorage( "pathslicing", - { - "root": self.tmpdir, - "slicing": self.slicing, - "compression": self.compression, - }, + root=self.tmpdir, + slicing=self.slicing, + compression=self.compression, ) def tearDown(self): diff --git a/swh/objstorage/tests/test_objstorage_random_generator.py b/swh/objstorage/tests/test_objstorage_random_generator.py --- a/swh/objstorage/tests/test_objstorage_random_generator.py +++ b/swh/objstorage/tests/test_objstorage_random_generator.py @@ -9,7 +9,7 @@ def test_random_generator_objstorage(): - sto = get_objstorage("random", {}) + sto = get_objstorage("random") assert sto blobs = [sto.get(None) for i in range(100)] @@ -18,7 +18,7 @@ def test_random_generator_objstorage_list_content(): - sto = get_objstorage("random", {"total": 100}) + sto = get_objstorage("random", total=100) assert isinstance(sto.list_content(), Iterator) assert list(sto.list_content()) == [b"%d" % i for i in range(1, 101)] @@ -29,11 +29,11 @@ def test_random_generator_objstorage_total(): - sto = get_objstorage("random", {"total": 5}) + sto = get_objstorage("random", total=5) assert len([x for x in sto]) == 5 def test_random_generator_objstorage_size(): - sto = get_objstorage("random", {"filesize": 10}) + sto = get_objstorage("random", filesize=10) for i in range(10): assert len(sto.get(None)) == 10 diff --git a/swh/objstorage/tests/test_objstorage_striping.py b/swh/objstorage/tests/test_objstorage_striping.py --- a/swh/objstorage/tests/test_objstorage_striping.py +++ b/swh/objstorage/tests/test_objstorage_striping.py @@ -21,26 +21,20 @@ os.mkdir(os.path.join(self.base_dir, "root2")) storage_config = { "cls": "striping", - "args": { - "objstorages": [ - { - "cls": "pathslicing", - "args": { - "root": os.path.join(self.base_dir, "root1"), - "slicing": "0:2", - "allow_delete": True, - }, - }, - { - "cls": "pathslicing", - "args": { - "root": os.path.join(self.base_dir, "root2"), - "slicing": "0:2", - "allow_delete": True, - }, - }, - ] - }, + "objstorages": [ + { + "cls": "pathslicing", + "root": os.path.join(self.base_dir, "root1"), + "slicing": "0:2", + "allow_delete": True, + }, + { + "cls": "pathslicing", + "root": os.path.join(self.base_dir, "root2"), + "slicing": "0:2", + "allow_delete": True, + }, + ], } self.storage = get_objstorage(**storage_config) diff --git a/swh/objstorage/tests/test_server.py b/swh/objstorage/tests/test_server.py --- a/swh/objstorage/tests/test_server.py +++ b/swh/objstorage/tests/test_server.py @@ -65,16 +65,14 @@ config = { "objstorage": { "cls": "pathslicing", - "args": { - "root": "root", - "slicing": "slicing", - }, + "root": "root", + "slicing": "slicing", "client_max_size": "10", } } for key in ("root", "slicing"): c = copy.deepcopy(config) - c["objstorage"]["args"].pop(key) + c["objstorage"].pop(key) config_path = prepare_config_file(tmpdir, c) with pytest.raises(KeyError, match=f"missing {key} config entry"): load_and_check_config(config_path) @@ -87,7 +85,8 @@ { "objstorage": { "cls": "pathslicing", - "args": {"root": "root", "slicing": "slicing"}, + "root": "root", + "slicing": "slicing", } }, id="pathslicing-bw-compat", @@ -103,7 +102,7 @@ id="pathslicing", ), pytest.param( - {"client_max_size": "10", "objstorage": {"cls": "memory", "args": {}}}, + {"client_max_size": "10", "objstorage": {"cls": "memory"}}, id="empty-args-bw-compat", ), pytest.param(