From c4870dbbf3b5294478f1fe1f8cc57a2b6de37fc5 Mon Sep 17 00:00:00 2001 From: alexandre menezes Date: Wed, 16 Mar 2022 13:34:42 -0300 Subject: [PATCH 1/2] CLI flow and required dependencies updated --- config/__init__.py | 2 +- config/cli.py | 6 ------ config/spring.py | 2 +- requirements.txt | 1 - setup.cfg | 4 ++-- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/config/__init__.py b/config/__init__.py index 61594a4..655e64f 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -3,7 +3,7 @@ from .cfenv import CFenv from .spring import ConfigClient, config_client, create_config_client -__version__ = "1.0.0" +__version__ = "1.0.1" __all__ = [ "__version__", "ConfigClient", diff --git a/config/cli.py b/config/cli.py index c4c3150..9ab5f27 100644 --- a/config/cli.py +++ b/config/cli.py @@ -3,11 +3,9 @@ import os import random import re -from pathlib import Path from typing import Any, List from cleo import Command -from dotenv import load_dotenv from requests.auth import HTTPBasicAuth, HTTPDigestAuth from rich.console import Console from rich.json import JSON @@ -19,11 +17,7 @@ from config.spring import ConfigClient logging.disable(logging.ERROR) - - console = Console() -env_path = Path(".") / ".env" -load_dotenv(dotenv_path=env_path) class ConfigClientCommand(Command): diff --git a/config/spring.py b/config/spring.py index e3a5e6b..977c2bf 100644 --- a/config/spring.py +++ b/config/spring.py @@ -78,7 +78,7 @@ def get_config(self, **kwargs) -> None: self._merge_dict(self._config, server_config) async def get_config_async(self, **kwargs) -> None: - loop = asyncio.get_event_loop() + loop = asyncio.get_running_loop() await loop.run_in_executor(None, partial(self.get_config, **kwargs)) def _configure_oauth2(self, **kwargs) -> dict: diff --git a/requirements.txt b/requirements.txt index c21b833..5a44860 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,4 @@ glom requests attrs cleo -python-dotenv rich diff --git a/setup.cfg b/setup.cfg index 4eaa50a..93a93aa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -45,9 +45,9 @@ install_requires = python_requires = >= 3.7 [options.extras_require] -cli = cleo>=0.7.6; python-dotenv>=0.10.3; rich +cli = cleo>=0.7.6; rich docs = portray -all = cleo>=0.7.6; python-dotenv>=0.10.3; portray; rich +all = cleo>=0.7.6; portray; rich [options.entry_points] console_scripts = From 5e60609a2e67468b03547a9376b1bed68af13994 Mon Sep 17 00:00:00 2001 From: alexandre menezes Date: Wed, 16 Mar 2022 13:43:59 -0300 Subject: [PATCH 2/2] updated test_cfenv.py --- tests/unit/test_spring.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/unit/test_spring.py b/tests/unit/test_spring.py index 88da3ea..52262e2 100644 --- a/tests/unit/test_spring.py +++ b/tests/unit/test_spring.py @@ -128,11 +128,8 @@ def test_keys(client): ], ) def test_get(client, monkeypatch, expr, expected, mocker): - # logging.basicConfig(level=logging.INFO) monkeypatch.setattr(http, "get", conftest.config_mock) client.get_config() - - # logging.info(f"INFO: {client.get('info')}") assert client.get(expr) == expected