aports/testing/py3-pyrad/fix-error-client-tests.patch
2024-10-17 20:31:14 +00:00

32 lines
1.2 KiB
Diff

Fix AttributeError in MockSocket. The error caused failures in testClient
tests: testAuthDelay, testDoubleAccountDelay, testSingleAccountDelay
```
Traceback (most recent call last):
File "/home/build/tests/py3-pyrad/src/pyrad-2.4/tests/testClient.py", line 125, in testAuthDelay
self.assertRaises(Timeout, self.client._SendPacket, packet, 432)
File "/usr/lib/python3.12/unittest/case.py", line 778, in assertRaises
return context.handle('assertRaises', args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/unittest/case.py", line 238, in handle
callable_obj(*args, **kwargs)
File "/home/build/tests/py3-pyrad/src/pyrad-2.4/pyrad/client.py", line 159, in _SendPacket
rawreply = self._socket.recv(4096)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/build/tests/py3-pyrad/src/pyrad-2.4/tests/mock.py", line 62, in recv
return self.data[:buffer]
^^^^^^^^^
AttributeError: 'MockSocket' object has no attribute 'data'
```
--- a/tests/mock.py
+++ b/tests/mock.py
@@ -42,6 +42,7 @@
self.options = []
self.address = None
self.output = []
+ self.data = []
if data is not None:
(self.read_end, self.write_end) = os.pipe()