From 4e0453ac46041731c04ca916ccd5eed6072bdde7 Mon Sep 17 00:00:00 2001 From: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Date: Mon, 1 Apr 2024 19:30:08 +0200 Subject: [PATCH] [Feature] - Auto-build test (#6271) * Auto-build test * Mark --- openbb_platform/tests/test_auto_build.py | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 openbb_platform/tests/test_auto_build.py diff --git a/openbb_platform/tests/test_auto_build.py b/openbb_platform/tests/test_auto_build.py new file mode 100644 index 000000000000..c1aa5314cac4 --- /dev/null +++ b/openbb_platform/tests/test_auto_build.py @@ -0,0 +1,35 @@ +"""Test the auto_build feature.""" + +import importlib +import sys +from unittest.mock import patch + +import pytest + +# pylint: disable=redefined-outer-name, unused-import, import-outside-toplevel + + +@pytest.fixture(autouse=True) +def setup_mocks(): + with patch( + "openbb_core.app.static.package_builder.PackageBuilder.auto_build" + ) as mock_auto_build: + mock_auto_build.return_value = None + yield mock_auto_build + + +@pytest.fixture +def openbb_module(setup_mocks): + if "openbb" in sys.modules: + importlib.reload(sys.modules["openbb"]) + else: + pass + return setup_mocks + + +@pytest.mark.integration +def test_autobuild_called(openbb_module): + """ + Test that auto_build is called upon importing openbb. + """ + openbb_module.assert_called_once()