Skip to content

Commit 43c4e52

Browse files
James Boultonclaude
andcommitted
Tests: wait for the certificate state callback, not just the state
The state changes before state_callback is called, so checking the callback's list as soon as the state was CERT raced on py313. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 8106a32 commit 43c4e52

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎tests/test_device_certificates.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def statuses(self, broker):
589589
def test_pending_certificate_logs_in_on_the_certificate_port(self):
590590
self.install(self.pki.device_ca)
591591
self.start()
592-
self.assertTrue(wait_for(lambda: self.certificates.state == CERT), "CERT after the first login")
592+
self.assertTrue(wait_for(lambda: self.states[-1:] == [CERT]), "CERT after the first login")
593593
self.assertEqual(self.cert_broker.client_ids, ["d-DEV1"])
594594
self.assertEqual(self.password_broker.client_ids, [])
595595
self.assertEqual(self.connection.password, "", "The password is erased")
@@ -610,7 +610,7 @@ def test_refused_pending_certificate_falls_back_to_the_password(self):
610610

611611
def test_first_certificate_from_the_server(self):
612612
self.start()
613-
self.assertTrue(wait_for(lambda: self.certificates.state == CERT, timeout=15), "PASSWORD, then PENDING, then CERT")
613+
self.assertTrue(wait_for(lambda: self.states[-1:] == [CERT], timeout=15), "PASSWORD, then PENDING, then CERT")
614614
self.assertEqual(self.states, [PENDING, CERT])
615615
self.assertEqual(self.cert_broker.client_ids, ["d-DEV1"])
616616
self.assertTrue(wait_for(lambda: self.connection.connection_state == ConnectionState.CONNECTED))

0 commit comments

Comments
 (0)