Skip to content

Commit

Permalink
fix: Teardown trino container correctly after tests
Browse files Browse the repository at this point in the history
Signed-off-by: Achal Shah <achals@gmail.com>
  • Loading branch information
achals committed Apr 18, 2022
1 parent 53c2ce2 commit e582d27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ install-go-ci-dependencies:
go install github.com/go-python/gopy

install-protoc-dependencies:
pip install grpcio-tools==1.34.0
pip install grpcio-tools==1.44.0

compile-protos-go: install-go-proto-dependencies install-protoc-dependencies
cd sdk/python && python setup.py build_go_protos
Expand Down
13 changes: 11 additions & 2 deletions sdk/python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,24 @@ def teardown(cls):
cls.container.stop()


@pytest.fixture(scope="session")
def trino_fixture(request):
def teardown():
TrinoContainerSingleton.teardown()

request.addfinalizer(teardown)
return TrinoContainerSingleton


@pytest.fixture(
params=FULL_REPO_CONFIGS, scope="session", ids=[str(c) for c in FULL_REPO_CONFIGS]
)
def environment(request, worker_id: str):
def environment(request, worker_id: str, trino_fixture):
if "TrinoSourceCreator" in request.param.offline_store_creator.__name__:
e = construct_test_environment(
request.param,
worker_id=worker_id,
offline_container=TrinoContainerSingleton.get_singleton(),
offline_container=trino_fixture.get_singleton(),
)
else:
e = construct_test_environment(request.param, worker_id=worker_id)
Expand Down

0 comments on commit e582d27

Please sign in to comment.