@pytest.fixture
def samp_hub(request):
 my_hub = SAMPHubServer()
 my_hub.start()
 request.addfinalizer(my_hub.stop)

@ pytest . fixture def samp_hub ( request ) : my_hub = SAMPHubServer ( ) my_hub . start ( ) request . addfinalizer ( my_hub . stop )
a fixture that can be used by client tests that require a hub .