Skip to content

Commit

Permalink
fix: tests case fail
Browse files Browse the repository at this point in the history
  • Loading branch information
manhinhang committed Apr 20, 2024
1 parent 2462f38 commit be4424f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/test_docker_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

IMAGE_NAME = os.environ['IMAGE_NAME']

@pytest.fixture(scope='function')
def ib_docker():
@pytest.fixture(scope='session')
def ib_docker(request):
account = os.environ['IB_ACCOUNT']
password = os.environ['IB_PASSWORD']
trading_mode = os.environ['TRADING_MODE']
Expand All @@ -21,8 +21,12 @@ def ib_docker():
'--env', 'TRADING_MODE={}'.format(trading_mode),
'-p', '4002:4002',
'-d', IMAGE_NAME]).decode().strip()

# at the end of the test suite, destroy the container
def remove_container():
subprocess.check_call(['docker', 'rm', '-f', docker_id])
request.addfinalizer(remove_container)
yield docker_id
subprocess.check_call(['docker', 'rm', '-f', docker_id])


def test_ibgw_interactive(ib_docker):
Expand Down

0 comments on commit be4424f

Please sign in to comment.