Skip to content

Commit 5ec1f84

Browse files
authored
refactor: Remove redundant teardown from interface tests (#1205)
The teardown method is called for all tests in the test_interface module by the ensure_worker_stopped fixture.
1 parent b356195 commit 5ec1f84

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

tests/unit_tests/service/test_interface.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,6 @@ def test_get_oidc_config(oidc_config: OIDCConfig):
349349
interface.set_config(ApplicationConfig(oidc=oidc_config))
350350
assert interface.get_oidc_config() == oidc_config
351351

352-
interface.teardown()
353-
354352

355353
def test_stomp_config(mock_stomp_client: StompClient):
356354
with patch(
@@ -415,8 +413,6 @@ def test_configure_numtracker():
415413
assert nt._headers == {"a": "b"}
416414
assert nt._url.unicode_string() == "https://numtracker-example.com/graphql"
417415

418-
interface.teardown()
419-
420416

421417
@patch("blueapi.client.numtracker.requests.post")
422418
def test_headers_are_cleared(mock_post):
@@ -468,8 +464,6 @@ def test_configure_numtracker_with_no_numtracker_config_fails():
468464

469465
assert nt is None
470466

471-
interface.teardown()
472-
473467

474468
def test_configure_numtracker_with_no_metadata_fails():
475469
conf = ApplicationConfig(numtracker=NumtrackerConfig())
@@ -481,8 +475,6 @@ def test_configure_numtracker_with_no_metadata_fails():
481475
with pytest.raises(InvalidConfigError):
482476
interface._try_configure_numtracker(headers)
483477

484-
interface.teardown()
485-
486478

487479
def test_setup_without_numtracker_with_existing_provider_does_not_overwrite_provider():
488480
conf = ApplicationConfig()
@@ -494,7 +486,6 @@ def test_setup_without_numtracker_with_existing_provider_does_not_overwrite_prov
494486
assert get_path_provider() == mock_provider
495487

496488
clear_path_provider()
497-
interface.teardown()
498489

499490

500491
def test_setup_without_numtracker_without_existing_provider_does_not_make_one():
@@ -504,8 +495,6 @@ def test_setup_without_numtracker_without_existing_provider_does_not_make_one():
504495
with pytest.raises(NameError):
505496
get_path_provider()
506497

507-
interface.teardown()
508-
509498

510499
def test_setup_with_numtracker_makes_start_document_provider():
511500
conf = ApplicationConfig(
@@ -520,7 +509,6 @@ def test_setup_with_numtracker_makes_start_document_provider():
520509
assert interface.context().run_engine.scan_id_source == interface._update_scan_num
521510

522511
clear_path_provider()
523-
interface.teardown()
524512

525513

526514
def test_setup_with_numtracker_raises_if_provider_is_defined_in_device_module():
@@ -545,7 +533,6 @@ def test_setup_with_numtracker_raises_if_provider_is_defined_in_device_module():
545533
interface.setup(conf)
546534

547535
clear_path_provider()
548-
interface.teardown()
549536

550537

551538
@patch("blueapi.client.numtracker.NumtrackerClient.create_scan")
@@ -567,8 +554,6 @@ def test_numtracker_create_scan_called_with_arguments_from_metadata(mock_create_
567554

568555
mock_create_scan.assert_called_once_with("ab123", "p46")
569556

570-
interface.teardown()
571-
572557

573558
def test_update_scan_num_side_effect_sets_data_session_directory_in_re_md(
574559
mock_numtracker_server,
@@ -589,8 +574,6 @@ def test_update_scan_num_side_effect_sets_data_session_directory_in_re_md(
589574
ctx.run_engine.md["data_session_directory"] == "/exports/mybeamline/data/2025"
590575
)
591576

592-
interface.teardown()
593-
594577

595578
def test_update_scan_num_side_effect_sets_scan_file_in_re_md(
596579
mock_numtracker_server,
@@ -608,5 +591,3 @@ def test_update_scan_num_side_effect_sets_scan_file_in_re_md(
608591
interface._update_scan_num(ctx.run_engine.md)
609592

610593
assert ctx.run_engine.md["scan_file"] == "p46-11"
611-
612-
interface.teardown()

0 commit comments

Comments
 (0)