99# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
1010# limitations under the License.
1111
12- import pytest
1312import os
13+
14+ import pytest
1415from assertpy import assert_that
1516from pcluster_topology_generator import (
1617 cleanup_topology_config_file ,
@@ -23,27 +24,21 @@ def _assert_files_are_equal(file, expected_file):
2324 assert_that (f .read ()).is_equal_to (exp_f .read ())
2425
2526
26- @pytest .mark .parametrize ("file_name_suffix" , [
27- "with_capacity_block" ,
28- "no_capacity_block"
29- ])
27+ @pytest .mark .parametrize ("file_name_suffix" , ["with_capacity_block" , "no_capacity_block" ])
3028def test_generate_topology_config (test_datadir , tmpdir , file_name_suffix ):
31- block_sizes = "9,18" if 'no' not in file_name_suffix else None
29+ block_sizes = "9,18" if "no" not in file_name_suffix else None
3230 file_name = "sample_" + file_name_suffix + ".yaml"
3331 input_file_path = str (test_datadir / file_name )
3432 output_file_name = "topology_" + file_name_suffix + ".conf"
3533 output_file_path = f"{ tmpdir } /{ output_file_name } "
3634 generate_topology_config_file (output_file_path , input_file_path , block_sizes )
37- if 'no' in file_name_suffix :
35+ if "no" in file_name_suffix :
3836 assert_that (os .path .isfile (output_file_path )).is_equal_to (False )
3937 else :
4038 _assert_files_are_equal (output_file_path , test_datadir / "expected_outputs" / output_file_name )
4139
4240
43- @pytest .mark .parametrize ("file_exists" , [
44- True ,
45- False
46- ])
41+ @pytest .mark .parametrize ("file_exists" , [True , False ])
4742def test_cleanup_topology_config_file (mocker , tmpdir , file_exists ):
4843 topology_file_path = tmpdir / "topology.conf"
4944 mocker .patch ("os.path.exists" , return_value = file_exists )
@@ -53,4 +48,3 @@ def test_cleanup_topology_config_file(mocker, tmpdir, file_exists):
5348 mock_remove .assert_called_once_with (str (topology_file_path ))
5449 else :
5550 mock_remove .assert_not_called ()
56-
0 commit comments