1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-12 23:37:14 +03:00

make tests not explode on windows

This commit is contained in:
A_D 2022-01-26 20:36:29 +02:00
parent 7bcf3a6f4d
commit 8c2a0ae95a
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4
2 changed files with 20 additions and 3 deletions

View File

@ -3,7 +3,7 @@ import os
import pathlib
import sys
from configparser import ConfigParser
from typing import List, Optional, Union
from typing import TYPE_CHECKING, List, Optional, Union
from config import AbstractConfig, appname, logger

View File

@ -1,4 +1,12 @@
"""Test the config system."""
"""
Test the config system.
Note: These tests to arbitrary reads and writes to an existing config, including
key deletions. Said modifications are to keys that are generated internally.
Most of these tests are parity tests with the "old" config, and likely one day can be
entirely removed.
"""
from __future__ import annotations
import contextlib
@ -19,7 +27,7 @@ print(sys.path)
from _old_config import old_config # noqa: E402
from config import LinuxConfig, config # noqa: E402
from config import config # noqa: E402
def _fuzz_list(length: int) -> List[str]:
@ -77,6 +85,11 @@ class TestNewConfig:
def __update_linuxconfig(self) -> None:
"""On linux config uses ConfigParser, which doesn't update from disk changes. Force the update here."""
if sys.platform != 'linux':
return
from config.linux import LinuxConfig
if isinstance(config, LinuxConfig) and config.config is not None:
config.config.read(config.filename)
@ -163,6 +176,10 @@ class TestOldNewConfig:
def __update_linuxconfig(self) -> None:
"""On linux config uses ConfigParser, which doesn't update from disk changes. Force the update here."""
if sys.platform != 'linux':
return
from config.linux import LinuxConfig
if isinstance(config, LinuxConfig) and config.config is not None:
config.config.read(config.filename)