mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 15:57:14 +03:00
tests: Attempt to fix config/ coverage
* Define `darwin` and `linux` *and* "platform known" pragmas. * Use per-platform pragmas in `config/__init__.py` selection of implementation. * Attempt, and fail, to use pragma in `config/darwin.py` to ignore it on other platforms.
This commit is contained in:
parent
1b0bbb9a56
commit
5efd27a83c
@ -454,19 +454,19 @@ def get_config(*args, **kwargs) -> AbstractConfig:
|
||||
:param kwargs: Args to be passed through to implementation.
|
||||
:return: Instance of the implementation.
|
||||
"""
|
||||
if sys.platform == "darwin":
|
||||
if sys.platform == "darwin": # pragma: sys-platform-not-darwin
|
||||
from .darwin import MacConfig
|
||||
return MacConfig(*args, **kwargs)
|
||||
|
||||
elif sys.platform == "win32":
|
||||
elif sys.platform == "win32": # pragma: sys-platform-not-win32
|
||||
from .windows import WinConfig
|
||||
return WinConfig(*args, **kwargs)
|
||||
|
||||
elif sys.platform == "linux":
|
||||
elif sys.platform == "linux": # pragma: sys-platform-not-linux
|
||||
from .linux import LinuxConfig
|
||||
return LinuxConfig(*args, **kwargs)
|
||||
|
||||
else:
|
||||
else: # pragma: sys-platform-known
|
||||
raise ValueError(f'Unknown platform: {sys.platform=}')
|
||||
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
"""Darwin/macOS implementation of AbstractConfig."""
|
||||
# This doesn't actually work:
|
||||
# <https://github.com/wemake-services/coverage-conditional-plugin/issues/2#issuecomment-1263899795>
|
||||
# pragma: sys-platform-not-darwin
|
||||
import pathlib
|
||||
import sys
|
||||
from typing import Any, Dict, List, Union
|
||||
|
@ -17,6 +17,11 @@ plugins = [ "coverage_conditional_plugin" ]
|
||||
[tool.coverage.coverage_conditional_plugin.rules]
|
||||
sys-platform-win32 = "sys_platform == 'win32'"
|
||||
sys-platform-not-win32 = "sys_platform != 'win32'"
|
||||
sys-platform-darwin = "sys_platform == 'darwin'"
|
||||
sys-platform-not-darwin = "sys_platform != 'darwin'"
|
||||
sys-platform-linux = "sys_platform == 'linux'"
|
||||
sys-platform-not-linux = "sys_platform != 'linux'"
|
||||
sys-platform-known = "sys_platform in ('darwin', 'linux', 'win32')"
|
||||
|
||||
[tool.pyright]
|
||||
# pythonPlatform = 'Darwin'
|
||||
|
Loading…
x
Reference in New Issue
Block a user