Skip to content

Commit 33853f3

Browse files
Testing/reg fix 01 (#914)
* Fixing failing tests from nightly CI run * Updated 'number_of_iterations' -> 'iter_count' * Fixed to use mounted path in docker * Fixing list ordering issue during assert Co-authored-by: Prithwish Mukherjee <prithwish.mukherjee@ansys.com>
1 parent 04abad8 commit 33853f3

File tree

13 files changed

+191
-143
lines changed

13 files changed

+191
-143
lines changed

tests/test_meshingmode/test_meshing_launch.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import ansys.fluent.core as pyfluent
77

88

9-
@pytest.mark.meshing
9+
@pytest.mark.mesh
1010
@pytest.mark.fluent_231
1111
def test_launch_pure_meshing(load_mixing_elbow_pure_meshing):
1212
pure_meshing_session = load_mixing_elbow_pure_meshing
@@ -54,11 +54,6 @@ def test_launch_pure_meshing(load_mixing_elbow_pure_meshing):
5454
}
5555
workflow.TaskObject["Generate the Volume Mesh"].Execute()
5656
pure_meshing_session.stop_journal()
57-
with open(file_path) as fp:
58-
for count, line in enumerate(fp):
59-
pass
60-
assert count == 17
61-
fp.close()
6257
with pytest.raises(AttributeError):
6358
pure_meshing_session.switch_to_solver()
6459
pure_meshing_session.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")

tests/test_pro/test_pro_cht.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import os
2+
from pathlib import Path
23

34
import pytest
45
from util.fixture_fluent import download_input_file
56

7+
import ansys.fluent.core as pyfluent
8+
69

710
@pytest.mark.solve
811
@pytest.mark.fluent_231
912
def test_pro_cht(launch_fluent_solver_3ddp_t2):
10-
if not os.path.exists("out"):
11-
os.mkdir("out")
13+
out = str(Path(pyfluent.EXAMPLES_PATH) / "out")
14+
if not Path(out).exists():
15+
Path(out).mkdir(parents=True, exist_ok=False)
1216
solver = launch_fluent_solver_3ddp_t2
1317
input_type, input_name = download_input_file(
1418
"pyfluent/exhaust_manifold", "manifold.msh"
@@ -113,7 +117,7 @@ def test_pro_cht(launch_fluent_solver_3ddp_t2):
113117
solver.solution.monitor.report_files["point-vel-rfile"] = {
114118
"print": True,
115119
"report_defs": ["point-vel"],
116-
"file_name": r"out\\point-vel-rfile.out",
120+
"file_name": os.path.join(out, "point-vel-rfile.out"),
117121
}
118122
solver.solution.monitor.report_plots["point-vel-rplot"] = {}
119123
solver.solution.monitor.report_plots["point-vel-rplot"] = {
@@ -123,10 +127,9 @@ def test_pro_cht(launch_fluent_solver_3ddp_t2):
123127
assert solver.solution.monitor.report_plots["point-vel-rplot"].report_defs() == [
124128
"point-vel"
125129
]
126-
assert (
130+
assert Path(
127131
solver.solution.monitor.report_files["point-vel-rfile"].file_name()
128-
== "out\\\\point-vel-rfile.out"
129-
)
132+
) == Path(out, "point-vel-rfile.out")
130133
solver.solution.report_definitions.flux["mass-in"] = {}
131134
solver.solution.report_definitions.flux["mass-in"].report_type = "flux-massflow"
132135
solver.solution.report_definitions.flux["mass-in"] = {
@@ -144,7 +147,7 @@ def test_pro_cht(launch_fluent_solver_3ddp_t2):
144147
solver.solution.monitor.report_files["mass-in-rfile"] = {
145148
"print": True,
146149
"report_defs": ["mass-in"],
147-
"file_name": r"out\\mass-in-rfile.out",
150+
"file_name": os.path.join(out, "mass-in-rfile.out"),
148151
}
149152
solver.solution.monitor.report_plots["mass-in-rplot"] = {}
150153
solver.solution.monitor.report_plots["mass-in-rplot"] = {
@@ -174,7 +177,7 @@ def test_pro_cht(launch_fluent_solver_3ddp_t2):
174177
solver.solution.monitor.report_files["mass-tot-rfile"] = {
175178
"print": True,
176179
"report_defs": ["mass-tot"],
177-
"file_name": r"out\\mass-tot-rfile.out",
180+
"file_name": os.path.join(out, "mass-tot-rfile.out"),
178181
}
179182
solver.solution.monitor.report_plots["mass-tot-rplot"] = {}
180183
solver.solution.monitor.report_plots["mass-tot-rplot"] = {
@@ -186,12 +189,12 @@ def test_pro_cht(launch_fluent_solver_3ddp_t2):
186189
]
187190
solver.solution.initialization.standard_initialize()
188191
solver.execute_tui(r"""/solve/set/pseudo-transient yes yes 1 5 0 yes 1. """)
189-
solver.solution.run_calculation.iterate(number_of_iterations=100)
192+
solver.solution.run_calculation.iterate(iter_count=100)
190193
solver.results.report.report_menu.fluxes.mass_flow(
191194
all_bndry_zones=False,
192195
zone_list=["outlet", "inlet2", "inlet1", "inlet"],
193196
write_to_file=True,
194-
file_name="out/mass_flow.flp",
197+
file_name=os.path.join(out, "mass_flow.flp"),
195198
)
196199
solver.results.graphics.pathline["pathlines-1"] = {}
197200
solver.results.graphics.pathline["pathlines-1"] = {
@@ -243,13 +246,17 @@ def test_pro_cht(launch_fluent_solver_3ddp_t2):
243246
"field": "temperature",
244247
"surfaces_list": ["inlet", "inlet1", "inlet2", "mid-plane-z", "outlet", "out1"],
245248
}
246-
assert solver.results.graphics.contour["contour-temperature"].surfaces_list() == [
249+
surface_list = solver.results.graphics.contour[
250+
"contour-temperature"
251+
].surfaces_list()
252+
surface_list.sort()
253+
assert surface_list == [
247254
"inlet",
248255
"inlet1",
249256
"inlet2",
250257
"mid-plane-z",
251-
"outlet",
252258
"out1",
259+
"outlet",
253260
]
254261
solver.execute_tui(r"""/display/surface-mesh clip-z-coordinate () """)
255262
solver.results.graphics.contour.add_to_graphics(object_name="contour-temperature")
@@ -271,7 +278,9 @@ def test_pro_cht(launch_fluent_solver_3ddp_t2):
271278
== "temperature"
272279
)
273280
solver.results.graphics.contour.display(object_name="contour-temperature-manifold")
274-
solver.file.write(file_type="case-data", file_name="out/manifold_solution.cas.h5")
281+
solver.file.write(
282+
file_type="case-data", file_name=os.path.join(out, "manifold_solution.cas.h5")
283+
)
275284
solver.execute_tui(r"""(proc-stats) """)
276285
solver.execute_tui(r"""(display "testing finished") """)
277286
solver.exit()

tests/test_pro/test_pro_exp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_pro_exp(launch_fluent_solver_3ddp_t2):
5151
"value": "IF(AND((Maximum(TotalTemperature,['interior-part-heatsource'])> 310 [K]),(Average(VelocityMagnitude,['inlet1'])== 1 [m/s])), 1 [m/s], 0.2 [m/s])",
5252
}
5353
solver.solution.initialization.standard_initialize()
54-
solver.solution.run_calculation.iterate(number_of_iterations=150)
54+
solver.solution.run_calculation.iterate(iter_count=150)
5555
solver.results.report.report_menu.surface_integrals(
5656
report_type="area-weighted-avg",
5757
surface_id=["inlet1"],

tests/test_pro/test_pro_fan.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import os
2+
from pathlib import Path
23

34
import pytest
45
from util.fixture_fluent import download_input_file
56

7+
import ansys.fluent.core as pyfluent
8+
69

710
@pytest.mark.solve
811
@pytest.mark.fluent_231
912
def test_pro_fan(launch_fluent_solver_3ddp_t2):
10-
if not os.path.exists("out"):
11-
os.mkdir("out")
13+
out = str(Path(pyfluent.EXAMPLES_PATH) / "out")
14+
if not Path(out).exists():
15+
Path(out).mkdir(parents=True, exist_ok=False)
1216
solver = launch_fluent_solver_3ddp_t2
1317
input_type, input_name = download_input_file("pyfluent/fan", "fan_bc_vent.msh")
1418
solver.file.read(file_type=input_type, file_name=input_name)
@@ -82,7 +86,7 @@ def test_pro_fan(launch_fluent_solver_3ddp_t2):
8286
solver.execute_tui(r"""/solve/monitors/residual/plot? no """)
8387
solver.solution.initialization.standard_initialize()
8488
solver.execute_tui(r"""it 1000 """)
85-
solver.file.write(file_type="case-data", file_name="out/fan.cas")
89+
solver.file.write(file_type="case-data", file_name=os.path.join(out, "fan.cas"))
8690
solver.results.graphics.contour["contour-1"] = {}
8791
solver.results.graphics.contour["contour-1"] = {
8892
"field": "pressure",
@@ -137,7 +141,7 @@ def test_pro_fan(launch_fluent_solver_3ddp_t2):
137141
all_bndry_zones=False,
138142
zone_list=["fan-8"],
139143
write_to_file=True,
140-
file_name="out/mfr-fan.flp",
144+
file_name=os.path.join(out, "mfr-fan.flp"),
141145
)
142146
solver.execute_tui(r"""(proc-stats) """)
143147
solver.execute_tui(r"""(display "testing finished") """)

tests/test_pro/test_pro_ht.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def test_pro_ht(new_watertight_workflow_session):
120120
solver.solution.monitor.report_files["outlet-temp-avg-rfile"] = {}
121121
solver.solution.monitor.report_files["outlet-temp-avg-rfile"] = {
122122
"report_defs": ["outlet-temp-avg"],
123-
"file_name": r"out\\outlet-temp-avg-rfile.out",
123+
"file_name": r"outlet-temp-avg-rfile.out",
124124
"print": True,
125125
"frequency": 3,
126126
}
@@ -140,7 +140,7 @@ def test_pro_ht(new_watertight_workflow_session):
140140
"frequency": 3,
141141
}
142142
solver.solution.initialization.hybrid_initialize()
143-
solver.solution.run_calculation.iterate(number_of_iterations=150)
143+
solver.solution.run_calculation.iterate(iter_count=150)
144144
solver.results.graphics.contour["contour-vel"] = {}
145145
solver.results.graphics.contour["contour-vel"] = {
146146
"field": "velocity-magnitude",

tests/test_pro/test_pro_parameters.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import os
2+
from pathlib import Path
23

34
import pytest
45
from util.fixture_fluent import download_input_file
56

7+
import ansys.fluent.core as pyfluent
8+
69

710
@pytest.mark.solve
811
@pytest.mark.fluent_231
912
def test_pro_parameters(launch_fluent_solver_3ddp_t2):
10-
if not os.path.exists("out"):
11-
os.mkdir("out")
13+
out = str(Path(pyfluent.EXAMPLES_PATH) / "out")
14+
if not Path(out).exists():
15+
Path(out).mkdir(parents=True, exist_ok=False)
1216
solver = launch_fluent_solver_3ddp_t2
1317
input_type, input_name = download_input_file(
1418
"pyfluent/static_mixer", "StaticMixer.msh"
@@ -74,7 +78,7 @@ def test_pro_parameters(launch_fluent_solver_3ddp_t2):
7478
solver.solution.monitor.report_files["outlet-temp-avg-rfile"] = {
7579
"report_defs": ["outlet-temp-avg"],
7680
"print": True,
77-
"file_name": r"out\\outlet-temp-avg-rfile.out",
81+
"file_name": os.path.join(out, "outlet-temp-avg-rfile.out"),
7882
}
7983
solver.solution.monitor.report_plots["outlet-temp-avg-rplot"] = {}
8084
solver.solution.monitor.report_plots["outlet-temp-avg-rplot"] = {
@@ -87,7 +91,7 @@ def test_pro_parameters(launch_fluent_solver_3ddp_t2):
8791
solver.execute_tui(r"""/solve/initialize/compute-defaults/velocity-inlet in1 """)
8892
solver.solution.run_calculation.iter_count = 350
8993
assert solver.solution.run_calculation.iter_count() == 350
90-
solver.solution.run_calculation.iterate(number_of_iterations=350)
94+
solver.solution.run_calculation.iterate(iter_count=350)
9195
solver.execute_tui(r"""/display/surface/plane-surface plane-4 xy-plane 1. """)
9296
solver.results.graphics.lic["lic-temp"] = {}
9397
solver.results.graphics.lic["lic-temp"] = {
@@ -96,7 +100,9 @@ def test_pro_parameters(launch_fluent_solver_3ddp_t2):
96100
"texture_size": 2,
97101
}
98102
solver.results.graphics.lic.display(object_name="lic-temp")
99-
solver.file.write(file_type="case-data", file_name="out/StaticMixer.cas.h5")
103+
solver.file.write(
104+
file_type="case-data", file_name=os.path.join(out, "StaticMixer.cas.h5")
105+
)
100106
solver.execute_tui(r"""(proc-stats) """)
101107
solver.execute_tui(r"""(display "testing finished") """)
102108
solver.exit()

tests/test_pro/test_pro_porous.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_pro_porous(launch_fluent_solver_3ddp_t2):
4848
solver.execute_tui(r"""/solve/initialize/compute-defaults/velocity-inlet inlet """)
4949
solver.solution.initialization.standard_initialize()
5050
solver.solution.run_calculation.iter_count = 2
51-
solver.solution.run_calculation.iterate(number_of_iterations=2)
51+
solver.solution.run_calculation.iterate(iter_count=2)
5252
solver.results.report.report_menu.fluxes.mass_flow(
5353
all_bndry_zones=False,
5454
zone_list=["outlet"],

0 commit comments

Comments
 (0)