Skip to content

Commit b2a5573

Browse files
committed
Clean integration
1 parent bf3f406 commit b2a5573

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

.github/workflows/test-metatrader5-integration.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test | MetaTrader5 Integration Test
1+
name: Test | Integration Test
22

33
on: [push]
44

@@ -70,23 +70,7 @@ jobs:
7070
env:
7171
MT5_LOGIN: ${{ secrets.MT5_LOGIN }}
7272
MT5_PASSWORD: ${{ secrets.MT5_PASSWORD }}
73+
MT5_SERVER: "'MetaQuotes-Demo'"
74+
MT5_PATH: "C:\\Program Files\\MetaTrader 5\\terminal64.exe"
7375
run: |
74-
python -c "import os, MetaTrader5 as mt5
75-
print('Python version:', os.sys.version)
76-
print('MetaTrader5 version:', mt5.__version__)
77-
for i in range(10):
78-
try:
79-
if mt5.initialize(login=int(os.getenv('MT5_LOGIN')),
80-
password=os.getenv('MT5_PASSWORD'),
81-
server='MetaQuotes-Demo',
82-
path='C:\\Program Files\\MetaTrader 5\\terminal64.exe'):
83-
print('MT5 initialized successfully')
84-
print(mt5.terminal_info())
85-
mt5.shutdown()
86-
exit(0)
87-
print(f'Attempt {i+1} failed')
88-
except Exception as e:
89-
print(f'Error: {str(e)}')
90-
import time; time.sleep(10)
91-
print('All attempts failed')
92-
exit(1)"
76+
python -c tests/integration/test_mt5_connection.py

tests/integration/test_mt5_connection.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
print('Testing MT5 initialization...')
66

77
success = False
8-
for attempt in range(12):
9-
if mt5.initialize():
8+
for attempt in range(10):
9+
if mt5.initialize(login=int(os.getenv('MT5_LOGIN')),
10+
password=os.getenv('MT5_PASSWORD'),
11+
server=os.getenv('MT5_SERVER'),
12+
path=os.getenv('MT5_PATH')):
1013
print('MT5 initialized successfully')
1114
mt5.shutdown()
1215
success = True

0 commit comments

Comments
 (0)