Thrift-5900: Fix Tests for Python 3.14
Client: py
Patch: Carel Combrink
This closes #3239
- Disclaimer: Claude came up with this
- Python 3.14 made files explicitly unpicklable for reasons
- The out can't be pickled in SummaryReporter
- stop in TestDispatcher is an instance method that should not be captured
Delay the imports to where they are needed
- Claude believes this is due to the way that the server is called vs the client is called and the server does not have enough time to set up completely
Attempt to fix issue with python 3.14
- Looks like python is getting more strict about scoping
- Decided to go with a local option instead of global or module variable
diff --git a/test/crossrunner/run.py b/test/crossrunner/run.py
index e532417..c401172 100644
--- a/test/crossrunner/run.py
+++ b/test/crossrunner/run.py
@@ -374,16 +374,18 @@
self._m = multiprocessing.managers.BaseManager()
self._m.register('ports', PortAllocator)
self._m.start()
- self._pool = multiprocessing.Pool(concurrency, self._pool_init, (self._m.address,))
+ self._pool = multiprocessing.Pool(concurrency, TestDispatcher._pool_init, (self._m.address, self._stop))
self._log.debug(
'TestDispatcher started with %d concurrent jobs' % concurrency)
- def _pool_init(self, address):
+ @staticmethod
+ def _pool_init(address, stop_event):
global stop
global m
global ports
- stop = self._stop
+ stop = stop_event
m = multiprocessing.managers.BaseManager(address)
+ m.register('ports')
m.connect()
ports = m.ports()