Fix wrong version number (#4429)

* remove refs to featureflags

* test refs to obbff

* test refs to obbff

* ruff

* fix unittest

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
montezdesousa
2023-03-08 15:54:34 +00:00
committed by GitHub
parent 3203048fc6
commit d9faafa9ad
9 changed files with 24 additions and 60 deletions

View File

@@ -240,7 +240,7 @@ class BuildCategoryModelClasses:
if module:
f.write(" def __init__(self):\r super().__init__()\r")
elif sdk_root:
f.write(" __version__ = obbff.VERSION\r\r")
f.write(" __version__ = cfg.VERSION\r\r")
f.write(" def __init__(self):\r SDKLogger()\r")
def write_class_attributes(

View File

@@ -81,7 +81,7 @@ try:
else:
raise Exception("Using git")
except Exception:
version = "2.4.1"
version = "2.5.1"
VERSION = str(os.getenv("OPENBB_VERSION", version))
# # Select the terminal translation language

View File

@@ -1,39 +0,0 @@
# IMPORTATION STANDARD
import os
import os.path
# IMPORTATION THIRDPARTY
import i18n
# IMPORTATION INTERNAL
from openbb_terminal.core.config.paths import (
MISCELLANEOUS_DIRECTORY,
)
from openbb_terminal.core.session.current_user import get_current_user
# pylint: disable=no-member,c-extension-no-member
try:
__import__("git")
except ImportError:
WITH_GIT = False
else:
WITH_GIT = True
try:
if not WITH_GIT:
import pkg_resources
version = pkg_resources.get_distribution("OpenBB").version
else:
raise Exception("Using git")
except Exception:
version = "2.5.1"
VERSION = str(os.getenv("OPENBB_VERSION", version))
# # Select the terminal translation language
i18n_dict_location = MISCELLANEOUS_DIRECTORY / "i18n"
i18n.load_path.append(i18n_dict_location)
i18n.set("locale", get_current_user().preferences.USE_LANGUAGE)
i18n.set("filename_format", "{locale}.{format}")

View File

@@ -12,8 +12,9 @@ from typing import List, Optional
# IMPORTATION THIRDPARTY
import pytz
from openbb_terminal.config_terminal import i18n_dict_location
# IMPORTATION INTERNAL
from openbb_terminal import feature_flags as obbff
from openbb_terminal.core.config.paths import (
SETTINGS_ENV_FILE,
USER_DATA_SOURCES_DEFAULT_FILE,
@@ -65,7 +66,7 @@ class SettingsController(BaseController):
languages_available = [
lang.strip(".yml")
for lang in os.listdir(obbff.i18n_dict_location)
for lang in os.listdir(i18n_dict_location)
if lang.endswith(".yml")
]

View File

@@ -17,10 +17,9 @@ import matplotlib.pyplot as plt
from packaging import version
from openbb_terminal import (
feature_flags as obbff,
thought_of_the_day as thought,
)
from openbb_terminal.config_terminal import LOGGING_COMMIT_HASH
from openbb_terminal.config_terminal import LOGGING_COMMIT_HASH, VERSION
# IMPORTATION INTERNAL
from openbb_terminal.core.config.paths import SETTINGS_ENV_FILE
@@ -266,7 +265,7 @@ def bootup():
def check_for_updates() -> None:
"""Check if the latest version is running.
Checks github for the latest release version and compares it to obbff.VERSION.
Checks github for the latest release version and compares it to cfg.VERSION.
"""
# The commit has was commented out because the terminal was crashing due to git import for multiple users
# ({str(git.Repo('.').head.commit)[:7]})
@@ -280,7 +279,7 @@ def check_for_updates() -> None:
if r is not None and r.status_code == 200:
latest_tag_name = r.json()["tag_name"]
latest_version = version.parse(latest_tag_name)
current_version = version.parse(obbff.VERSION)
current_version = version.parse(VERSION)
if check_valid_versions(latest_version, current_version):
if current_version == latest_version:
@@ -328,7 +327,7 @@ def welcome_message():
Prints first welcome message, help and a notification if updates are available.
"""
console.print(f"\nWelcome to OpenBB Terminal v{obbff.VERSION}")
console.print(f"\nWelcome to OpenBB Terminal v{VERSION}")
if get_current_user().preferences.ENABLE_THOUGHTS_DAY:
console.print("---------------------------------")

View File

@@ -6,7 +6,6 @@ from unittest.mock import patch
# IMPORTATION THIRDPARTY
from openbb_terminal import (
config_terminal as cfg,
feature_flags as obbff,
)
from openbb_terminal.account import account_model
from openbb_terminal.core.config import paths
@@ -151,7 +150,6 @@ def test_get_diff_settings_empty_settings():
def test_get_diff_settings_no_diff():
obbff.value = 1
cfg.value = 1
paths.value = 1
diff = account_model.get_diff_settings({"value": 1})

View File

@@ -4,6 +4,8 @@ from typing import List
import pandas as pd
import pytest
from openbb_terminal.core.models.preferences_model import PreferencesModel
from openbb_terminal.core.session.current_user import copy_user
from openbb_terminal.custom_prompt_toolkit import NestedCompleter
try:
@@ -39,14 +41,24 @@ def test_check_greater_than_one_invalid():
def test_forecast_controller(mocker):
mocker.patch(base + "session", True)
mocker.patch(base + "obbff.USE_PROMPT_TOOLKIT", True)
preferences = PreferencesModel(USE_PROMPT_TOOLKIT=True)
mock_current_user = copy_user(preferences=preferences)
mocker.patch(
target="openbb_terminal.core.session.current_user.__current_user",
new=mock_current_user,
)
cont = fc.ForecastController(data=df, ticker="TSLA")
assert isinstance(cont.files, List)
def test_fc_update_runtime_choices(mocker):
mocker.patch(base + "session", True)
mocker.patch(base + "obbff.USE_PROMPT_TOOLKIT", True)
preferences = PreferencesModel(USE_PROMPT_TOOLKIT=True)
mock_current_user = copy_user(preferences=preferences)
mocker.patch(
target="openbb_terminal.core.session.current_user.__current_user",
new=mock_current_user,
)
cont = fc.ForecastController()
cont.datasets = {"stonks": df}
cont.update_runtime_choices()

View File

@@ -31,13 +31,6 @@ def fixture_test_user():
return test_user
class obbff:
"""Mock obbff."""
USE_FLAIR = ":openbb"
SYNC_ENABLED = True
def test_load_user_info(test_user):
"""Test load user info."""
assert test_user.profile.token == "test_token"

View File

@@ -85,7 +85,7 @@ def test_check_for_updates(mocker, last_release, current_release):
# MOCK FF VERSION
mocker.patch(
target="openbb_terminal.feature_flags.VERSION",
target="openbb_terminal.config_terminal.VERSION",
new=current_release,
)