diff options
author | Rob Hudson <robhudson@mozilla.com> | 2023-05-17 09:19:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 23:19:14 +0700 |
commit | ea063edf0a790630d0800808fe6236b3e9ddcf22 (patch) | |
tree | ead2cb88df0fd1a7b4d03f578d9aa9692381e566 /tests/test_helpers.py | |
parent | bbfeb8c8ed2913e980412ee7606c171fdf37e713 (diff) | |
download | rq-ea063edf0a790630d0800808fe6236b3e9ddcf22.tar.gz |
Update linting configuration (#1915)
* Update linting configuration
This removes flake8 in favor of ruff, which also provides isort support, and
updates all files to be black, isort, and ruff compliant. This also adds black
and ruff checks to the tox and Github linting workflow.
* Tweak the code coverage config and calls
Diffstat (limited to 'tests/test_helpers.py')
-rw-r--r-- | tests/test_helpers.py | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 5a84f71..c351b77 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -1,16 +1,14 @@ -from rq.cli.helpers import get_redis_from_config +from unittest import mock +from rq.cli.helpers import get_redis_from_config from tests import RQTestCase -from unittest import mock -class TestHelpers(RQTestCase): +class TestHelpers(RQTestCase): @mock.patch('rq.cli.helpers.Sentinel') def test_get_redis_from_config(self, sentinel_class_mock): """Ensure Redis connection params are properly parsed""" - settings = { - 'REDIS_URL': 'redis://localhost:1/1' - } + settings = {'REDIS_URL': 'redis://localhost:1/1'} # Ensure REDIS_URL is read redis = get_redis_from_config(settings) @@ -23,7 +21,7 @@ class TestHelpers(RQTestCase): 'REDIS_HOST': 'foo', 'REDIS_DB': 2, 'REDIS_PORT': 2, - 'REDIS_PASSWORD': 'bar' + 'REDIS_PASSWORD': 'bar', } # Ensure REDIS_URL is preferred @@ -42,23 +40,29 @@ class TestHelpers(RQTestCase): self.assertEqual(connection_kwargs['password'], 'bar') # Add Sentinel to the settings - settings.update({ - 'SENTINEL': { - 'INSTANCES':[('remote.host1.org', 26379), ('remote.host2.org', 26379), ('remote.host3.org', 26379)], - 'MASTER_NAME': 'master', - 'DB': 2, - 'USERNAME': 'redis-user', - 'PASSWORD': 'redis-secret', - 'SOCKET_TIMEOUT': None, - 'CONNECTION_KWARGS': { - 'ssl_ca_path': None, - }, - 'SENTINEL_KWARGS': { - 'username': 'sentinel-user', - 'password': 'sentinel-secret', + settings.update( + { + 'SENTINEL': { + 'INSTANCES': [ + ('remote.host1.org', 26379), + ('remote.host2.org', 26379), + ('remote.host3.org', 26379), + ], + 'MASTER_NAME': 'master', + 'DB': 2, + 'USERNAME': 'redis-user', + 'PASSWORD': 'redis-secret', + 'SOCKET_TIMEOUT': None, + 'CONNECTION_KWARGS': { + 'ssl_ca_path': None, + }, + 'SENTINEL_KWARGS': { + 'username': 'sentinel-user', + 'password': 'sentinel-secret', + }, }, - }, - }) + } + ) # Ensure SENTINEL is preferred against REDIS_* parameters redis = get_redis_from_config(settings) @@ -66,7 +70,7 @@ class TestHelpers(RQTestCase): sentinel_init_sentinel_kwargs = sentinel_class_mock.call_args[1] self.assertEqual( sentinel_init_sentinels_args, - ([('remote.host1.org', 26379), ('remote.host2.org', 26379), ('remote.host3.org', 26379)],) + ([('remote.host1.org', 26379), ('remote.host2.org', 26379), ('remote.host3.org', 26379)],), ) self.assertDictEqual( sentinel_init_sentinel_kwargs, @@ -80,6 +84,6 @@ class TestHelpers(RQTestCase): 'sentinel_kwargs': { 'username': 'sentinel-user', 'password': 'sentinel-secret', - } - } + }, + }, ) |