Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong version number #4429

Merged
merged 7 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generate_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def write_class_attr_docs(
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(
Expand Down
2 changes: 1 addition & 1 deletion openbb_terminal/config_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def start_required_configurations():
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
Expand Down
39 changes: 0 additions & 39 deletions openbb_terminal/feature_flags.py

This file was deleted.

5 changes: 3 additions & 2 deletions openbb_terminal/settings_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
# 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,
Expand Down Expand Up @@ -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")
]

Expand Down
9 changes: 4 additions & 5 deletions openbb_terminal/terminal_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
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
Expand Down Expand Up @@ -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]})
Expand All @@ -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:
Expand Down Expand Up @@ -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("---------------------------------")
Expand Down
2 changes: 0 additions & 2 deletions tests/openbb_terminal/account/test_account_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# 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
Expand Down Expand Up @@ -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})
Expand Down
16 changes: 14 additions & 2 deletions tests/openbb_terminal/forecast/test_forecast_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
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:
Expand Down Expand Up @@ -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()
Expand Down
7 changes: 0 additions & 7 deletions tests/openbb_terminal/session/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/openbb_terminal/test_terminal_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down