def test_determine_host_port(): original_value = os.environ.get('AGENT_HOST_PORT', None) os.environ['AGENT_HOST_PORT'] = 'localhost:1234' host, port = _determine_host_port() # Before any assertions, restore original environment variable. if original_value: os.environ['AGENT_HOST_PORT'] = original_value assert host == 'localhost' assert port == 1234