Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add missing close in livetest
  • Loading branch information
yunhaoling committed Jul 31, 2019
commit 72c8e37bafde242c66ec756576743633fb931d35
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ async def test_send_with_invalid_hostname_async(invalid_hostname, connstr_receiv
sender = client.create_producer()
with pytest.raises(AuthenticationError):
await sender.send(EventData("test data"))
await sender.close()


@pytest.mark.liveTest
Expand All @@ -39,6 +40,7 @@ async def test_receive_with_invalid_hostname_async(invalid_hostname):
receiver = client.create_consumer(consumer_group="$default", partition_id="0", event_position=EventPosition("-1"))
with pytest.raises(AuthenticationError):
await receiver.receive(timeout=3)
await receiver.close()


@pytest.mark.liveTest
Expand All @@ -49,6 +51,7 @@ async def test_send_with_invalid_key_async(invalid_key, connstr_receivers):
sender = client.create_producer()
with pytest.raises(AuthenticationError):
await sender.send(EventData("test data"))
await sender.close()


@pytest.mark.liveTest
Expand All @@ -58,6 +61,7 @@ async def test_receive_with_invalid_key_async(invalid_key):
receiver = client.create_consumer(consumer_group="$default", partition_id="0", event_position=EventPosition("-1"))
with pytest.raises(AuthenticationError):
await receiver.receive(timeout=3)
await receiver.close()


@pytest.mark.liveTest
Expand All @@ -68,6 +72,7 @@ async def test_send_with_invalid_policy_async(invalid_policy, connstr_receivers)
sender = client.create_producer()
with pytest.raises(AuthenticationError):
await sender.send(EventData("test data"))
await sender.close()


@pytest.mark.liveTest
Expand All @@ -77,6 +82,7 @@ async def test_receive_with_invalid_policy_async(invalid_policy):
receiver = client.create_consumer(consumer_group="$default", partition_id="0", event_position=EventPosition("-1"))
with pytest.raises(AuthenticationError):
await receiver.receive(timeout=3)
await receiver.close()


@pytest.mark.liveTest
Expand Down
3 changes: 2 additions & 1 deletion sdk/eventhub/azure-eventhubs/tests/test_negative.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_send_with_invalid_hostname(invalid_hostname, connstr_receivers):
sender = client.create_producer()
with pytest.raises(AuthenticationError):
sender.send(EventData("test data"))
sender.close()


@pytest.mark.liveTest
Expand Down Expand Up @@ -96,13 +97,13 @@ def test_non_existing_entity_sender(connection_str):
sender = client.create_producer(partition_id="1")
with pytest.raises(AuthenticationError):
sender.send(EventData("test data"))
sender.close()


@pytest.mark.liveTest
def test_non_existing_entity_receiver(connection_str):
client = EventHubClient.from_connection_string(connection_str, event_hub_path="nemo", network_tracing=False)
receiver = client.create_consumer(consumer_group="$default", partition_id="0", event_position=EventPosition("-1"))

with pytest.raises(AuthenticationError):
receiver.receive(timeout=5)
receiver.close()
Expand Down