9
9
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
10
10
# limitations under the License.
11
11
12
- import pytest
13
12
import os
13
+
14
+ import pytest
14
15
from assertpy import assert_that
15
16
from pcluster_topology_generator import (
16
17
cleanup_topology_config_file ,
@@ -23,27 +24,21 @@ def _assert_files_are_equal(file, expected_file):
23
24
assert_that (f .read ()).is_equal_to (exp_f .read ())
24
25
25
26
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" ])
30
28
def 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
32
30
file_name = "sample_" + file_name_suffix + ".yaml"
33
31
input_file_path = str (test_datadir / file_name )
34
32
output_file_name = "topology_" + file_name_suffix + ".conf"
35
33
output_file_path = f"{ tmpdir } /{ output_file_name } "
36
34
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 :
38
36
assert_that (os .path .isfile (output_file_path )).is_equal_to (False )
39
37
else :
40
38
_assert_files_are_equal (output_file_path , test_datadir / "expected_outputs" / output_file_name )
41
39
42
40
43
- @pytest .mark .parametrize ("file_exists" , [
44
- True ,
45
- False
46
- ])
41
+ @pytest .mark .parametrize ("file_exists" , [True , False ])
47
42
def test_cleanup_topology_config_file (mocker , tmpdir , file_exists ):
48
43
topology_file_path = tmpdir / "topology.conf"
49
44
mocker .patch ("os.path.exists" , return_value = file_exists )
@@ -53,4 +48,3 @@ def test_cleanup_topology_config_file(mocker, tmpdir, file_exists):
53
48
mock_remove .assert_called_once_with (str (topology_file_path ))
54
49
else :
55
50
mock_remove .assert_not_called ()
56
-
0 commit comments