From 70a031cacac19f8203f2137ab433065326068831 Mon Sep 17 00:00:00 2001 From: Sermet Pekin Date: Sat, 20 Apr 2024 17:58:51 +0300 Subject: [PATCH] tests --- evdspy/EVDSlocal/tests/test_user_requests.py | 36 +++----------------- evdspy/EVDSlocal/utils/utils_test.py | 32 +++++++++++++++++ 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/evdspy/EVDSlocal/tests/test_user_requests.py b/evdspy/EVDSlocal/tests/test_user_requests.py index 3204814..ab7062d 100644 --- a/evdspy/EVDSlocal/tests/test_user_requests.py +++ b/evdspy/EVDSlocal/tests/test_user_requests.py @@ -5,51 +5,23 @@ default_end_date_fnc, get_series from evdspy.EVDSlocal.utils.github_actions import GithubActions from evdspy.EVDSlocal.utils.utils_general import get_env_api_key -from evdspy.EVDSlocal.utils.utils_test import get_api_key_while_testing, ApiClassWhileTesting, get_api_key_file +from evdspy.EVDSlocal.utils.utils_test import get_api_key_while_testing, ApiClassWhileTesting, get_api_key_file, \ + skip_if_gthub, skip_if_not_keyvalid, is_df from evdspy.EVDSlocal.index_requests.get_series_indexes_utils import Frequency, freq_enum, Formulas, AggregationType, \ correct_types # from evdspy.EVDSlocal.index_requests.user_requests import from evdspy.EVDSlocal.config.apikey_class import ApikeyClass from evdspy.EVDSlocal.index_requests.get_series_indexes_utils import default_start_date_fnc, default_end_date_fnc from evdspy.EVDSlocal.index_requests.user_requests.user_requests import ProxyManager, UrlBuilder, UrlSeries, \ - ApiRequester, \ - DataProcessor, RequestConfig + ApiRequester, DataProcessor, RequestConfig +# from evdspy.EVDSlocal.index_requests.get_series_indexes_utils import * try: - import pytest except ImportError: pass -import sys - - -def get_api_key(): - import os - return os.getenv("EVDS_API_KEY") - - -# assert isinstance(get_api_key(), str) and len(get_api_key()) == 10 -def key_valid(): - return isinstance(get_api_key(), str) and len(get_api_key()) == 10 - - -def is_df(df: Any): - return isinstance(df, pd.DataFrame) - - -def gth_testing(): - return GithubActions().is_testing() - - -reason_gth = "passing when github Actions " -skip_if_gthub = pytest.mark.skipif( - gth_testing, reason=reason_gth -) -skip_if_not_keyvalid = pytest.mark.skipif( - key_valid(), reason='No Api key Valid provided' -) @skip_if_gthub diff --git a/evdspy/EVDSlocal/utils/utils_test.py b/evdspy/EVDSlocal/utils/utils_test.py index 5909f2c..9dce7c1 100644 --- a/evdspy/EVDSlocal/utils/utils_test.py +++ b/evdspy/EVDSlocal/utils/utils_test.py @@ -20,6 +20,19 @@ """Globals """ EVDS_API_KEY_ENV_NAME = "EVDS_API_KEY" +try: + import pytest +except ImportError: + pass + + +def get_api_key(): + import os + return os.getenv("EVDS_API_KEY") + + +def key_valid(): + return isinstance(get_api_key(), str) and len(get_api_key()) == 10 def is_df(df: Any): @@ -32,6 +45,25 @@ def gth_testing(): reason_gth = "passing when github Actions " +skip_if_gthub = pytest.mark.skipif( + gth_testing, reason=reason_gth +) + +skip_if_not_keyvalid = pytest.mark.skipif( + key_valid(), reason='No Api key Valid provided' +) + + +# def is_df(df: Any): +# return isinstance(df, pd.DataFrame) + + +# def gth_testing(): +# return GithubActions().is_testing() + + +# reason_gth = "passing when github Actions " +# def get_api_env_key_name(): return EVDS_API_KEY_ENV_NAME