From 60da6a2e4030fd77f458e00ffcc8628d7e46dc4d Mon Sep 17 00:00:00 2001 From: Paul Profizi <100710998+PProfizi@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:44:45 +0200 Subject: [PATCH] Remove rogue prints from tests (#449) * Remove rogue prints from test * remove progress bars from test_selection.py * Add explicit test of FluidSimulation.__str__() --- tests/test_fluid_simulation.py | 9 +++++---- tests/test_mesh_info.py | 2 +- tests/test_selection.py | 6 ++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/test_fluid_simulation.py b/tests/test_fluid_simulation.py index e1992f857..e4d378769 100644 --- a/tests/test_fluid_simulation.py +++ b/tests/test_fluid_simulation.py @@ -40,8 +40,9 @@ def cfx_simulation(self): ) return post.FluidSimulation(ds) # noqa - def test_simulation_init(self, fluent_simulation): + def test_simulation_str(self, fluent_simulation): assert fluent_simulation is not None + assert str(fluent_simulation) @pytest.mark.parametrize( "result_name", @@ -110,12 +111,12 @@ def test_fluid_simulation_phases(self, fluent_simulation): assert isinstance(fluent_simulation.phases, PhasesDict) def test_fluid_simulation_result_unavailable(self, fluent_simulation): - print(fluent_simulation) + # print(fluent_simulation) with pytest.raises(ValueError, match="is not available."): _ = fluent_simulation.wall_shear_stress() def test_results_fluent_averaging_from_elemental(self, fluent_simulation): - print(fluent_simulation) + # print(fluent_simulation) # ######## Elemental Result ################# # Request on None result = fluent_simulation.enthalpy() @@ -145,7 +146,7 @@ def test_results_fluent_averaging_from_elemental(self, fluent_simulation): assert result._core_object[0].location == post.locations.elemental def test_results_fluent_averaging_from_elemental_faces(self, fluent_simulation): - print(fluent_simulation) + # print(fluent_simulation) # ######## ElementalFaces Result ################# # Request on None result = fluent_simulation.static_pressure() diff --git a/tests/test_mesh_info.py b/tests/test_mesh_info.py index ca6f26c6e..a3c689f87 100644 --- a/tests/test_mesh_info.py +++ b/tests/test_mesh_info.py @@ -27,7 +27,7 @@ def fluent_simulation(self): return post.FluidSimulation(ds) # noqa def test_fluid_mesh_info_print(self, fluent_simulation): - print(fluent_simulation.mesh_info) + # print(fluent_simulation.mesh_info) ref = ( "Fluid mesh metadata\n" "-------------------\n" diff --git a/tests/test_selection.py b/tests/test_selection.py index 6b871c584..08a882af5 100644 --- a/tests/test_selection.py +++ b/tests/test_selection.py @@ -12,6 +12,7 @@ def test_spatial_selection_select_nodes(allkindofcomplexity): simulation = post.load_simulation(allkindofcomplexity) selection = SpatialSelection() + selection._selection.progress_bar = False selection.select_nodes([1, 2, 3]) scoping = selection._evaluate_on(simulation) assert scoping.location == post.locations.nodal @@ -21,6 +22,7 @@ def test_spatial_selection_select_nodes(allkindofcomplexity): def test_spatial_selection_select_elements(allkindofcomplexity): simulation = post.load_simulation(allkindofcomplexity) selection = SpatialSelection() + selection._selection.progress_bar = False selection.select_elements([1, 2, 3, 4]) scoping = selection._evaluate_on(simulation) assert scoping.location == post.locations.elemental @@ -32,6 +34,7 @@ def test_spatial_selection_select_elements(allkindofcomplexity): def test_spatial_selection_select_named_selection(allkindofcomplexity): simulation = post.load_simulation(allkindofcomplexity) selection = SpatialSelection() + selection._selection.progress_bar = False selection.select_named_selection( simulation.mesh.named_selections.keys()[0], location=post.selection.locations.nodal, @@ -68,6 +71,7 @@ def fluent_simulation(self): def test_spatial_selection_select_faces(self, fluent_simulation): selection = SpatialSelection() + selection._selection.progress_bar = False selection.select_faces(fluent_simulation.mesh.face_ids) scoping = selection._evaluate_on(fluent_simulation) assert scoping.location == post.locations.faces @@ -75,6 +79,7 @@ def test_spatial_selection_select_faces(self, fluent_simulation): def test_spatial_selection_select_nodes_of_faces(self, fluent_simulation): selection = SpatialSelection() + selection._selection.progress_bar = False face_0 = fluent_simulation.mesh.faces[0] selection.select_nodes_of_faces( faces=[face_0.id], @@ -86,6 +91,7 @@ def test_spatial_selection_select_nodes_of_faces(self, fluent_simulation): def test_spatial_selection_select_faces_of_elements(self, fluent_simulation): selection = SpatialSelection() + selection._selection.progress_bar = False elem_0 = fluent_simulation.mesh.elements[0] selection.select_faces_of_elements( elements=[elem_0.id],