summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Radovanovic <74266147+IgorWounds@users.noreply.github.com>2024-04-01 19:30:08 +0200
committerGitHub <noreply@github.com>2024-04-01 17:30:08 +0000
commit4e0453ac46041731c04ca916ccd5eed6072bdde7 (patch)
tree637aeea4a91b8dcdf33164a45796938c9c20c316
parentad8df992d1e52bd05e8a3c07336c196b37681d5d (diff)
[Feature] - Auto-build test (#6271)
* Auto-build test * Mark
-rw-r--r--openbb_platform/tests/test_auto_build.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/openbb_platform/tests/test_auto_build.py b/openbb_platform/tests/test_auto_build.py
new file mode 100644
index 00000000000..c1aa5314cac
--- /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()