Skip to content

Commit 722a18c

Browse files
committed
change: fixuture renaming
1 parent 3b9f467 commit 722a18c

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

tests/integ/test_auto_ml.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@
4949

5050

5151
# use a succeeded AutoML job to test describe and list candidates method, otherwise tests will run too long
52-
# reusable-job will be created once if it doesn't exist, and be reused in relevant tests.
52+
# test-session-job will be created once per session if it doesn't exist, and be reused in relevant tests.
5353
@pytest.fixture(scope="module")
54-
def reusable_job_name():
55-
job_name = unique_name_from_base("reusable-job", max_length=32)
54+
def test_session_job_name():
55+
job_name = unique_name_from_base("test-session-job", max_length=32)
5656
return job_name
5757

5858

@@ -199,7 +199,7 @@ def test_auto_ml_invalid_target_attribute(sagemaker_session):
199199
tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS,
200200
reason="AutoML is not supported in the region yet.",
201201
)
202-
def test_auto_ml_describe_auto_ml_job(sagemaker_session, reusable_job_name):
202+
def test_auto_ml_describe_auto_ml_job(sagemaker_session, test_session_job_name):
203203
expected_default_input_config = [
204204
{
205205
"DataSource": {
@@ -221,13 +221,13 @@ def test_auto_ml_describe_auto_ml_job(sagemaker_session, reusable_job_name):
221221
)
222222
}
223223

224-
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, reusable_job_name)
224+
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, test_session_job_name)
225225
auto_ml = AutoML(
226226
role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session
227227
)
228228

229-
desc = auto_ml.describe_auto_ml_job(job_name=reusable_job_name)
230-
assert desc["AutoMLJobName"] == reusable_job_name
229+
desc = auto_ml.describe_auto_ml_job(job_name=test_session_job_name)
230+
assert desc["AutoMLJobName"] == test_session_job_name
231231
assert desc["AutoMLJobStatus"] == "Completed"
232232
assert isinstance(desc["BestCandidate"], dict)
233233
assert desc["InputDataConfig"] == expected_default_input_config
@@ -239,7 +239,7 @@ def test_auto_ml_describe_auto_ml_job(sagemaker_session, reusable_job_name):
239239
tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS,
240240
reason="AutoML is not supported in the region yet.",
241241
)
242-
def test_auto_ml_attach(sagemaker_session, reusable_job_name):
242+
def test_auto_ml_attach(sagemaker_session, test_session_job_name):
243243
expected_default_input_config = [
244244
{
245245
"DataSource": {
@@ -261,13 +261,13 @@ def test_auto_ml_attach(sagemaker_session, reusable_job_name):
261261
)
262262
}
263263

264-
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, reusable_job_name)
264+
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, test_session_job_name)
265265

266266
attached_automl_job = AutoML.attach(
267-
auto_ml_job_name=reusable_job_name, sagemaker_session=sagemaker_session
267+
auto_ml_job_name=test_session_job_name, sagemaker_session=sagemaker_session
268268
)
269269
attached_desc = attached_automl_job.describe_auto_ml_job()
270-
assert attached_desc["AutoMLJobName"] == reusable_job_name
270+
assert attached_desc["AutoMLJobName"] == test_session_job_name
271271
assert attached_desc["AutoMLJobStatus"] == "Completed"
272272
assert isinstance(attached_desc["BestCandidate"], dict)
273273
assert attached_desc["InputDataConfig"] == expected_default_input_config
@@ -279,28 +279,28 @@ def test_auto_ml_attach(sagemaker_session, reusable_job_name):
279279
tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS,
280280
reason="AutoML is not supported in the region yet.",
281281
)
282-
def test_list_candidates(sagemaker_session, reusable_job_name):
283-
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, reusable_job_name)
282+
def test_list_candidates(sagemaker_session, test_session_job_name):
283+
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, test_session_job_name)
284284

285285
auto_ml = AutoML(
286286
role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session
287287
)
288288

289-
candidates = auto_ml.list_candidates(job_name=reusable_job_name)
289+
candidates = auto_ml.list_candidates(job_name=test_session_job_name)
290290
assert len(candidates) == 3
291291

292292

293293
@pytest.mark.skipif(
294294
tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS,
295295
reason="AutoML is not supported in the region yet.",
296296
)
297-
def test_best_candidate(sagemaker_session, reusable_job_name):
298-
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, reusable_job_name)
297+
def test_best_candidate(sagemaker_session, test_session_job_name):
298+
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, test_session_job_name)
299299

300300
auto_ml = AutoML(
301301
role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session
302302
)
303-
best_candidate = auto_ml.best_candidate(job_name=reusable_job_name)
303+
best_candidate = auto_ml.best_candidate(job_name=test_session_job_name)
304304
assert len(best_candidate["InferenceContainers"]) == 3
305305
assert len(best_candidate["CandidateSteps"]) == 4
306306
assert best_candidate["CandidateStatus"] == "Completed"
@@ -311,13 +311,13 @@ def test_best_candidate(sagemaker_session, reusable_job_name):
311311
reason="AutoML is not supported in the region yet.",
312312
)
313313
@pytest.mark.release
314-
def test_deploy_best_candidate(sagemaker_session, cpu_instance_type, reusable_job_name):
315-
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, reusable_job_name)
314+
def test_deploy_best_candidate(sagemaker_session, cpu_instance_type, test_session_job_name):
315+
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, test_session_job_name)
316316

317317
auto_ml = AutoML(
318318
role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session
319319
)
320-
best_candidate = auto_ml.best_candidate(job_name=reusable_job_name)
320+
best_candidate = auto_ml.best_candidate(job_name=test_session_job_name)
321321
endpoint_name = unique_name_from_base("sagemaker-auto-ml-best-candidate-test")
322322

323323
with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES):
@@ -343,15 +343,15 @@ def test_deploy_best_candidate(sagemaker_session, cpu_instance_type, reusable_jo
343343
reason="",
344344
)
345345
def test_candidate_estimator_default_rerun_and_deploy(
346-
sagemaker_session, cpu_instance_type, reusable_job_name
346+
sagemaker_session, cpu_instance_type, test_session_job_name
347347
):
348-
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, reusable_job_name)
348+
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, test_session_job_name)
349349

350350
auto_ml = AutoML(
351351
role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session
352352
)
353353

354-
candidates = auto_ml.list_candidates(job_name=reusable_job_name)
354+
candidates = auto_ml.list_candidates(job_name=test_session_job_name)
355355
candidate = candidates[1]
356356

357357
candidate_estimator = CandidateEstimator(candidate, sagemaker_session)
@@ -377,13 +377,13 @@ def test_candidate_estimator_default_rerun_and_deploy(
377377
tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS,
378378
reason="AutoML is not supported in the region yet.",
379379
)
380-
def test_candidate_estimator_get_steps(sagemaker_session, reusable_job_name):
381-
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, reusable_job_name)
380+
def test_candidate_estimator_get_steps(sagemaker_session, test_session_job_name):
381+
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session, test_session_job_name)
382382

383383
auto_ml = AutoML(
384384
role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session
385385
)
386-
candidates = auto_ml.list_candidates(job_name=reusable_job_name)
386+
candidates = auto_ml.list_candidates(job_name=test_session_job_name)
387387
candidate = candidates[1]
388388

389389
candidate_estimator = CandidateEstimator(candidate, sagemaker_session)

0 commit comments

Comments
 (0)