@@ -84,9 +84,9 @@ def remove_timestamp(metrics: List):
84
84
85
85
86
86
def test_single_metric (capsys , metric , dimension , namespace ):
87
- with single_metric (** metric ) as my_metrics :
88
- my_metrics .add_dimension (** dimension )
89
- my_metrics .add_namespace (** namespace )
87
+ with single_metric (** metric ) as my_metric :
88
+ my_metric .add_dimension (** dimension )
89
+ my_metric .add_namespace (** namespace )
90
90
91
91
output = json .loads (capsys .readouterr ().out .strip ())
92
92
expected = serialize_single_metric (metric = metric , dimension = dimension , namespace = namespace )
@@ -96,11 +96,11 @@ def test_single_metric(capsys, metric, dimension, namespace):
96
96
97
97
98
98
def test_single_metric_one_metric_only (capsys , metric , dimension , namespace ):
99
- with single_metric (** metric ) as my_metrics :
100
- my_metrics .add_metric (name = "second_metric" , unit = "Count" , value = 1 )
101
- my_metrics .add_metric (name = "third_metric" , unit = "Seconds" , value = 1 )
102
- my_metrics .add_dimension (** dimension )
103
- my_metrics .add_namespace (** namespace )
99
+ with single_metric (** metric ) as my_metric :
100
+ my_metric .add_metric (name = "second_metric" , unit = "Count" , value = 1 )
101
+ my_metric .add_metric (name = "third_metric" , unit = "Seconds" , value = 1 )
102
+ my_metric .add_dimension (** dimension )
103
+ my_metric .add_namespace (** namespace )
104
104
105
105
output = json .loads (capsys .readouterr ().out .strip ())
106
106
expected = serialize_single_metric (metric = metric , dimension = dimension , namespace = namespace )
@@ -130,11 +130,11 @@ def test_multiple_namespaces(metric, dimension, namespace):
130
130
namespace_b = {"name" : "AnotherNamespace" }
131
131
132
132
with pytest .raises (UniqueNamespaceError ):
133
- with single_metric (** metric ) as m :
134
- m .add_dimension (** dimension )
135
- m .add_namespace (** namespace )
136
- m .add_namespace (** namespace_a )
137
- m .add_namespace (** namespace_b )
133
+ with single_metric (** metric ) as my_metric :
134
+ my_metric .add_dimension (** dimension )
135
+ my_metric .add_namespace (** namespace )
136
+ my_metric .add_namespace (** namespace_a )
137
+ my_metric .add_namespace (** namespace_b )
138
138
139
139
140
140
def test_log_metrics (capsys , metrics , dimensions , namespace ):
@@ -224,23 +224,23 @@ def test_incorrect_metric_unit(metric, dimension, namespace):
224
224
metric ["unit" ] = "incorrect_unit"
225
225
226
226
with pytest .raises (MetricUnitError ):
227
- with single_metric (** metric ) as m :
228
- m .add_dimension (** dimension )
229
- m .add_namespace (** namespace )
227
+ with single_metric (** metric ) as my_metric :
228
+ my_metric .add_dimension (** dimension )
229
+ my_metric .add_namespace (** namespace )
230
230
231
231
232
232
def test_schema_no_namespace (metric , dimension ):
233
233
with pytest .raises (SchemaValidationError ):
234
- with single_metric (** metric ) as m :
235
- m .add_dimension (** dimension )
234
+ with single_metric (** metric ) as my_metric :
235
+ my_metric .add_dimension (** dimension )
236
236
237
237
238
238
def test_schema_incorrect_value (metric , dimension , namespace ):
239
239
metric ["value" ] = "some_value"
240
240
with pytest .raises (MetricValueError ):
241
- with single_metric (** metric ) as m :
242
- m .add_dimension (** dimension )
243
- m .add_namespace (** namespace )
241
+ with single_metric (** metric ) as my_metric :
242
+ my_metric .add_dimension (** dimension )
243
+ my_metric .add_namespace (** namespace )
244
244
245
245
246
246
def test_schema_no_metrics (dimensions , namespace ):
@@ -258,7 +258,7 @@ def test_exceed_number_of_dimensions(metric, namespace):
258
258
dimensions .append ({"name" : f"test_{ i } " , "value" : "test" })
259
259
260
260
with pytest .raises (SchemaValidationError ):
261
- with single_metric (** metric ) as m :
262
- m .add_namespace (** namespace )
261
+ with single_metric (** metric ) as my_metric :
262
+ my_metric .add_namespace (** namespace )
263
263
for dimension in dimensions :
264
- m .add_dimension (** dimension )
264
+ my_metric .add_dimension (** dimension )
0 commit comments