Skip to content

Commit

Permalink
Label test name to docker container (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkundu1 authored Sep 27, 2022
1 parent 7467358 commit b6941a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ unittest-dev-231:
unittest-all-222:
@echo "Running all unittests"
@pip install -r requirements/requirements_tests.txt
@pytest -v -m "not fluent_231" --cov=ansys.fluent --cov-report html:cov_html --cov-config=.coveragerc
@pytest -v -m "not fluent_231" --cov=ansys.fluent --cov-report html:cov_html --cov-config=.coveragerc --durations=0

unittest-all-231:
@echo "Running all unittests"
@pip install -r requirements/requirements_tests.txt
@pytest -v -m "not fluent_222" --cov=ansys.fluent --cov-report html:cov_html --cov-config=.coveragerc
@pytest -v -m "not fluent_222" --cov=ansys.fluent --cov-report html:cov_html --cov-config=.coveragerc --durations=0

api-codegen:
@echo "Running API codegen"
Expand Down
3 changes: 3 additions & 0 deletions src/ansys/fluent/core/launcher/fluent_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def start_fluent_container(mounted_from: str, mounted_to: str, args: List[str])
port = _get_free_port()
container_sifile = mounted_to + "/" + Path(sifile).name
image_tag = os.getenv("FLUENT_IMAGE_TAG", "v22.2.0")
test_name = os.getenv("PYFLUENT_TEST_NAME", "none")

try:
subprocess.run(
Expand All @@ -57,6 +58,8 @@ def start_fluent_container(mounted_from: str, mounted_to: str, args: List[str])
f"REMOTING_PORTS={port}/portspan=2",
"-e",
"FLUENT_LAUNCHED_FROM_PYFLUENT=1",
"-l",
f"test_name={test_name}",
f"ghcr.io/pyansys/pyfluent:{image_tag}",
"-gu",
f"-sifile={container_sifile}",
Expand Down
5 changes: 4 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ def pytest_collection_modifyitems(items, config):


@pytest.fixture
def with_launching_container(monkeypatch: pytest.MonkeyPatch) -> None:
def with_launching_container(
monkeypatch: pytest.MonkeyPatch, request: pytest.FixtureRequest
) -> None:
monkeypatch.setenv("PYFLUENT_LAUNCH_CONTAINER", "1")
monkeypatch.setenv("PYFLUENT_TEST_NAME", request.node.name)

0 comments on commit b6941a6

Please sign in to comment.