Skip to content

Commit 9ae3b95

Browse files
committed
Improve a test case by using dynamic port
1 parent fcd9779 commit 9ae3b95

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tests/test_authcode.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ def test_setup_at_a_ephemeral_port_and_teardown(self):
1717
self.assertNotEqual(port, receiver.get_port())
1818

1919
def test_no_two_concurrent_receivers_can_listen_on_same_port(self):
20-
port = 12345 # Assuming this port is available
21-
with AuthCodeReceiver(port=port) as receiver:
20+
with AuthCodeReceiver() as receiver:
2221
expected_error = OSError if sys.version_info[0] > 2 else socket.error
2322
with self.assertRaises(expected_error):
24-
with AuthCodeReceiver(port=port) as receiver2:
23+
with AuthCodeReceiver(port=receiver.get_port()):
2524
pass
2625

0 commit comments

Comments
 (0)