mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Format code with black, autopep8 and isort
This commit fixes the style issues introduced indd50a9baccording to the output from black, autopep8 and isort. Details:4e472085-2e87-4f61-b7a1-ed208506962f/
This commit is contained in:
parent
dd50a9b13e
commit
af4ceef153
28 changed files with 1214 additions and 720 deletions
|
|
@ -4,18 +4,23 @@ from _pytest.config import UsageError
|
|||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption("--redis", default=None,
|
||||
help="run tests which require redis connection")
|
||||
parser.addoption(
|
||||
"--redis", default=None, help="run tests which require redis connection"
|
||||
)
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
config.addinivalue_line("markers", "redis: marked tests require redis connection to run")
|
||||
config.addinivalue_line(
|
||||
"markers", "redis: marked tests require redis connection to run"
|
||||
)
|
||||
|
||||
|
||||
def pytest_collection_modifyitems(config, items):
|
||||
redis_uri = config.getoption("--redis")
|
||||
if redis_uri is None:
|
||||
skip_redis = pytest.mark.skip(reason="need --redis option with redis URI to run")
|
||||
skip_redis = pytest.mark.skip(
|
||||
reason="need --redis option with redis URI to run"
|
||||
)
|
||||
for item in items:
|
||||
if "redis" in item.keywords:
|
||||
item.add_marker(skip_redis)
|
||||
|
|
@ -23,14 +28,16 @@ def pytest_collection_modifyitems(config, items):
|
|||
try:
|
||||
address, options = aioredis.util.parse_url(redis_uri)
|
||||
if not isinstance(address, tuple):
|
||||
raise AssertionError("Only redis and rediss schemas are supported, eg redis://foo.")
|
||||
raise AssertionError(
|
||||
"Only redis and rediss schemas are supported, eg redis://foo."
|
||||
)
|
||||
except AssertionError as e:
|
||||
raise UsageError(f"Invalid redis URI {redis_uri!r}: {e}")
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
@pytest.fixture(scope="session")
|
||||
def redis_options(request):
|
||||
redis_uri = request.config.getoption("--redis")
|
||||
(host, port), options = aioredis.util.parse_url(redis_uri)
|
||||
options.update({'host': host, 'port': port})
|
||||
options.update({"host": host, "port": port})
|
||||
return options
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue