Skip to content

Commit

Permalink
Merge pull request #1297 from bug-or-feature/fix_ci_build
Browse files Browse the repository at this point in the history
Fix CI build
  • Loading branch information
robcarver17 authored Dec 1, 2023
2 parents 3681d76 + 03f85c2 commit d93edd2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
17 changes: 8 additions & 9 deletions sysdata/tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from sysdata.config.configdata import Config
from sysdata.config.control_config import get_control_config
from sysdata.config.private_directory import PRIVATE_CONFIG_DIR_ENV_VAR
import os


class TestConfig:
Expand All @@ -11,16 +10,16 @@ def test_default(self):
assert config.get_element("ib_idoffset") == 100

def test_custom_dir(self, monkeypatch):
envs = {PRIVATE_CONFIG_DIR_ENV_VAR: "sysdata.tests.custom_private_config"}
monkeypatch.setattr(os, "environ", envs)
monkeypatch.setenv(
PRIVATE_CONFIG_DIR_ENV_VAR, "sysdata.tests.custom_private_config"
)

Config.reset()
config = Config.default_config()
assert config.get_element("ib_idoffset") == 1000

def test_bad_custom_dir(self, monkeypatch):
envs = {PRIVATE_CONFIG_DIR_ENV_VAR: "sysdata.tests"}
monkeypatch.setattr(os, "environ", envs)
monkeypatch.setenv(PRIVATE_CONFIG_DIR_ENV_VAR, "sysdata.tests")

Config.reset()
config = Config.default_config()
Expand All @@ -34,8 +33,9 @@ def test_default_control(self):
)

def test_control_custom_dir(self, monkeypatch):
envs = {PRIVATE_CONFIG_DIR_ENV_VAR: "sysdata.tests.custom_private_config"}
monkeypatch.setattr(os, "environ", envs)
monkeypatch.setenv(
PRIVATE_CONFIG_DIR_ENV_VAR, "sysdata.tests.custom_private_config"
)

config = get_control_config()
assert (
Expand All @@ -44,8 +44,7 @@ def test_control_custom_dir(self, monkeypatch):
)

def test_control_bad_custom_dir(self, monkeypatch):
envs = {PRIVATE_CONFIG_DIR_ENV_VAR: "sysdata.tests"}
monkeypatch.setattr(os, "environ", envs)
monkeypatch.setenv(PRIVATE_CONFIG_DIR_ENV_VAR, "sysdata.tests")

config = get_control_config()
assert (
Expand Down
2 changes: 1 addition & 1 deletion systems/accounts/curves/account_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def sortino(self):
return sortino

def vals(self):
vals = self.values[~np.isnan(self.values)]
vals = pd.to_numeric(self.values[~pd.isnull(self.values)], errors="coerce")

return vals

Expand Down
8 changes: 6 additions & 2 deletions systems/tests/test_position_sizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def setUp(self):
self.data = data
self.position_sizing = PositionSizing

def tearDown(self) -> None:
self.monkeypatch.undo()

@unittest.SkipTest
def test_get_combined_forecast(self):
self.assertAlmostEqual(
Expand Down Expand Up @@ -60,8 +63,9 @@ def test_get_instrument_sizing_data(self):
self.assertEqual(ans[1], 2500)

def test_get_daily_cash_vol_target(self):
envs = {PRIVATE_CONFIG_DIR_ENV_VAR: "sysdata.tests.custom_private_config"}
self.monkeypatch.setattr(os, "environ", envs)
self.monkeypatch.setenv(
PRIVATE_CONFIG_DIR_ENV_VAR, "sysdata.tests.custom_private_config"
)

ans_dict = self.system.positionSize.get_vol_target_dict()
self.assertEqual(ans_dict["base_currency"], "GBP")
Expand Down

0 comments on commit d93edd2

Please sign in to comment.