|
15 | 15 | """ |
16 | 16 |
|
17 | 17 | import argparse |
18 | | -from xpk.parser.cluster import set_cluster_create_parser |
| 18 | +from xpk.parser.cluster import set_cluster_create_parser, set_cluster_create_pathways_parser, set_cluster_create_ray_parser |
19 | 19 | import pytest |
20 | 20 | from ..utils.feature_flags import FeatureFlags |
21 | 21 |
|
@@ -64,3 +64,69 @@ def test_cluster_create_sub_slicing_can_be_set(): |
64 | 64 | ) |
65 | 65 |
|
66 | 66 | assert args.sub_slicing is True |
| 67 | + |
| 68 | + |
| 69 | +def test_cluster_create_pathways_sub_slicing_is_hidden_with_flag_off(): |
| 70 | + FeatureFlags.SUB_SLICING_ENABLED = False |
| 71 | + parser = argparse.ArgumentParser() |
| 72 | + |
| 73 | + set_cluster_create_pathways_parser(parser) |
| 74 | + help_str = parser.format_help() |
| 75 | + |
| 76 | + assert "--sub-slicing" not in help_str |
| 77 | + |
| 78 | + |
| 79 | +def test_cluster_create_pathways_sub_slicing_is_shown_with_flag_on(): |
| 80 | + parser = argparse.ArgumentParser() |
| 81 | + |
| 82 | + set_cluster_create_pathways_parser(parser) |
| 83 | + help_str = parser.format_help() |
| 84 | + |
| 85 | + assert "--sub-slicing" in help_str |
| 86 | + |
| 87 | + |
| 88 | +def test_cluster_create_pathways_sub_slicing_is_false_by_default(): |
| 89 | + parser = argparse.ArgumentParser() |
| 90 | + |
| 91 | + set_cluster_create_pathways_parser(parser) |
| 92 | + args = parser.parse_args( |
| 93 | + ["--cluster", "test-cluster", "--tpu-type", "test-tpu"] |
| 94 | + ) |
| 95 | + |
| 96 | + assert args.sub_slicing is False |
| 97 | + |
| 98 | + |
| 99 | +def test_cluster_create_pathways_sub_slicing_can_be_set(): |
| 100 | + parser = argparse.ArgumentParser() |
| 101 | + |
| 102 | + set_cluster_create_pathways_parser(parser) |
| 103 | + args = parser.parse_args( |
| 104 | + ["--cluster", "test-cluster", "--tpu-type", "test-tpu", "--sub-slicing"] |
| 105 | + ) |
| 106 | + |
| 107 | + assert args.sub_slicing is True |
| 108 | + |
| 109 | + |
| 110 | +def test_cluster_create_ray_sub_slicing_is_hidden(): |
| 111 | + parser = argparse.ArgumentParser() |
| 112 | + |
| 113 | + set_cluster_create_ray_parser(parser) |
| 114 | + help_str = parser.format_help() |
| 115 | + |
| 116 | + assert "--sub-slicing" not in help_str |
| 117 | + |
| 118 | + |
| 119 | +def test_cluster_create_ray_sub_slicing_is_false(): |
| 120 | + parser = argparse.ArgumentParser() |
| 121 | + |
| 122 | + set_cluster_create_ray_parser(parser) |
| 123 | + args = parser.parse_args([ |
| 124 | + "--cluster", |
| 125 | + "test-cluster", |
| 126 | + "--tpu-type", |
| 127 | + "test-tpu", |
| 128 | + "--ray-version", |
| 129 | + "1.0.0", |
| 130 | + ]) |
| 131 | + |
| 132 | + assert args.sub_slicing is False |
0 commit comments