Skip to content
Snippets Groups Projects
Unverified Commit 80813ab4 authored by Andrej Shadura's avatar Andrej Shadura
Browse files

Make config parser and its tests flake8-clean


Drop unused imports, drop extra empty lines, replace a wildcard
import with a series of specific imports.

Fixes: abd77e4d ("Add configuration de/serialisation code")

Signed-off-by: default avatarAndrej Shadura <andrew.shadura@collabora.co.uk>
parent 9a0ca9a5
No related branches found
No related tags found
No related merge requests found
Pipeline #546254 passed with warnings
......@@ -17,7 +17,7 @@ from configparser import ConfigParser
from dataclasses import dataclass, is_dataclass
from logging import error
from pathlib import Path
from typing import Iterable, Mapping
from typing import Mapping
HTTP_TIMEOUT = 20 * 60
......@@ -184,12 +184,10 @@ class Config:
cachedir=cachedir,
)
def __post_init__(self):
if self.tracedir:
self.tracedir.mkdir(parents=True, exist_ok=True)
def as_dict(self):
def serialize(o):
if is_dataclass(o):
......@@ -204,7 +202,6 @@ class Config:
return serialize(self)
def update_from_dict(self, d):
def deserialize(o, c, d):
if is_dataclass(o):
......
import io
import pytest
from obs_proxy.config import *
from obs_proxy.config import (
Config,
AuthConfig,
BackendConfig,
ClientConfig,
ServerConfig,
)
basic_config = """
......@@ -124,12 +129,12 @@ def test_mini_config():
insecure=False,
buffer_uploads=False,
keyfile=None,
certfile=None
certfile=None,
),
client=ClientConfig(
host='0.0.0.0',
port=5000,
buffer_uploads=True
buffer_uploads=True,
),
auth=AuthConfig(
username='luser',
......@@ -138,7 +143,7 @@ def test_mini_config():
),
backend=BackendConfig(
srcserver_uri=None,
repserver_uri=None
repserver_uri=None,
),
worker_ports=None,
debug=False,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment