Skip to content
Merged
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
10 changes: 10 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
stop_after_attempt,
)

try:
import munch # noqa: F401

munch_installed = True
except ImportError:
munch_installed = False

RETRYABLE = (ApiExceededException, TokenInvalidException)

Expand Down Expand Up @@ -417,6 +423,7 @@ def test_fetch_market_by_epic(self, ig_service: IGService):
response = ig_service.fetch_market_by_epic("CS.D.EURUSD.MINI.IP")
assert isinstance(response, dict)

@pytest.mark.skipif(not munch_installed, reason="Requires munch")
def test_fetch_markets_by_epics(self, ig_service: IGService):
markets_list = ig_service.fetch_markets_by_epics(
"IX.D.SPTRD.MONTH1.IP,IX.D.FTSE.DAILY.IP", version="1"
Expand Down Expand Up @@ -663,6 +670,7 @@ def test_fetch_historical_prices_by_epic_mid(self, ig_service: IGService):
assert prices.shape[0] == 5
assert prices.shape[1] == 5

@pytest.mark.skipif(not munch_installed, reason="Requires munch")
def test_create_open_position(self, ig_service: IGService):
epic = "IX.D.FTSE.DAILY.IP"
market_info = ig_service.fetch_market_by_epic(epic)
Expand Down Expand Up @@ -728,6 +736,7 @@ def test_create_open_position(self, ig_service: IGService):
assert close_result["dealStatus"] == "ACCEPTED"
assert close_result["reason"] == "SUCCESS"

@pytest.mark.skipif(not munch_installed, reason="Requires munch")
def test_create_working_order(self, ig_service: IGService):
epic = "CS.D.GBPUSD.TODAY.IP"
market_info = ig_service.fetch_market_by_epic(epic)
Expand Down Expand Up @@ -761,6 +770,7 @@ def test_create_working_order(self, ig_service: IGService):
assert delete_result["dealStatus"] == "ACCEPTED"
assert delete_result["reason"] == "SUCCESS"

@pytest.mark.skipif(not munch_installed, reason="Requires munch")
def test_create_working_order_guaranteed_stop_loss(self, ig_service: IGService):
epic = "CS.D.GBPUSD.TODAY.IP"
market_info = ig_service.fetch_market_by_epic(epic)
Expand Down