Skip to content

Commit 60da6a2

Browse files
authored
Remove rogue prints from tests (#449)
* Remove rogue prints from test * remove progress bars from test_selection.py * Add explicit test of FluidSimulation.__str__()
1 parent 225b8ed commit 60da6a2

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

tests/test_fluid_simulation.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ def cfx_simulation(self):
4040
)
4141
return post.FluidSimulation(ds) # noqa
4242

43-
def test_simulation_init(self, fluent_simulation):
43+
def test_simulation_str(self, fluent_simulation):
4444
assert fluent_simulation is not None
45+
assert str(fluent_simulation)
4546

4647
@pytest.mark.parametrize(
4748
"result_name",
@@ -110,12 +111,12 @@ def test_fluid_simulation_phases(self, fluent_simulation):
110111
assert isinstance(fluent_simulation.phases, PhasesDict)
111112

112113
def test_fluid_simulation_result_unavailable(self, fluent_simulation):
113-
print(fluent_simulation)
114+
# print(fluent_simulation)
114115
with pytest.raises(ValueError, match="is not available."):
115116
_ = fluent_simulation.wall_shear_stress()
116117

117118
def test_results_fluent_averaging_from_elemental(self, fluent_simulation):
118-
print(fluent_simulation)
119+
# print(fluent_simulation)
119120
# ######## Elemental Result #################
120121
# Request on None
121122
result = fluent_simulation.enthalpy()
@@ -145,7 +146,7 @@ def test_results_fluent_averaging_from_elemental(self, fluent_simulation):
145146
assert result._core_object[0].location == post.locations.elemental
146147

147148
def test_results_fluent_averaging_from_elemental_faces(self, fluent_simulation):
148-
print(fluent_simulation)
149+
# print(fluent_simulation)
149150
# ######## ElementalFaces Result #################
150151
# Request on None
151152
result = fluent_simulation.static_pressure()

tests/test_mesh_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def fluent_simulation(self):
2727
return post.FluidSimulation(ds) # noqa
2828

2929
def test_fluid_mesh_info_print(self, fluent_simulation):
30-
print(fluent_simulation.mesh_info)
30+
# print(fluent_simulation.mesh_info)
3131
ref = (
3232
"Fluid mesh metadata\n"
3333
"-------------------\n"

tests/test_selection.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
def test_spatial_selection_select_nodes(allkindofcomplexity):
1313
simulation = post.load_simulation(allkindofcomplexity)
1414
selection = SpatialSelection()
15+
selection._selection.progress_bar = False
1516
selection.select_nodes([1, 2, 3])
1617
scoping = selection._evaluate_on(simulation)
1718
assert scoping.location == post.locations.nodal
@@ -21,6 +22,7 @@ def test_spatial_selection_select_nodes(allkindofcomplexity):
2122
def test_spatial_selection_select_elements(allkindofcomplexity):
2223
simulation = post.load_simulation(allkindofcomplexity)
2324
selection = SpatialSelection()
25+
selection._selection.progress_bar = False
2426
selection.select_elements([1, 2, 3, 4])
2527
scoping = selection._evaluate_on(simulation)
2628
assert scoping.location == post.locations.elemental
@@ -32,6 +34,7 @@ def test_spatial_selection_select_elements(allkindofcomplexity):
3234
def test_spatial_selection_select_named_selection(allkindofcomplexity):
3335
simulation = post.load_simulation(allkindofcomplexity)
3436
selection = SpatialSelection()
37+
selection._selection.progress_bar = False
3538
selection.select_named_selection(
3639
simulation.mesh.named_selections.keys()[0],
3740
location=post.selection.locations.nodal,
@@ -68,13 +71,15 @@ def fluent_simulation(self):
6871

6972
def test_spatial_selection_select_faces(self, fluent_simulation):
7073
selection = SpatialSelection()
74+
selection._selection.progress_bar = False
7175
selection.select_faces(fluent_simulation.mesh.face_ids)
7276
scoping = selection._evaluate_on(fluent_simulation)
7377
assert scoping.location == post.locations.faces
7478
assert np.allclose(scoping.ids, fluent_simulation.mesh.face_ids)
7579

7680
def test_spatial_selection_select_nodes_of_faces(self, fluent_simulation):
7781
selection = SpatialSelection()
82+
selection._selection.progress_bar = False
7883
face_0 = fluent_simulation.mesh.faces[0]
7984
selection.select_nodes_of_faces(
8085
faces=[face_0.id],
@@ -86,6 +91,7 @@ def test_spatial_selection_select_nodes_of_faces(self, fluent_simulation):
8691

8792
def test_spatial_selection_select_faces_of_elements(self, fluent_simulation):
8893
selection = SpatialSelection()
94+
selection._selection.progress_bar = False
8995
elem_0 = fluent_simulation.mesh.elements[0]
9096
selection.select_faces_of_elements(
9197
elements=[elem_0.id],

0 commit comments

Comments
 (0)