Skip to content

Fix Python 3.14 for pytest-backend #133

@ArBridgeman

Description

@ArBridgeman

When running the unit tests for Python 3.14, we run into a pickling error. This should be investigated and resolved.

=================================== FAILURES ===================================
_______________________________ test_my_brewery ________________________________

    def test_my_brewery():
>       with my_brewery_async() as brewery:
             ^^^^^^^^^^^^^^^^^^

test/unit/test_parallel_task.py:31: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/contextlib.py:141: in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
test/unit/test_parallel_task.py:24: in my_brewery_async
    with brewery_factory(
exasol/pytest_backend/parallel_task.py:43: in __enter__
    self._proc.start()
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/process.py:121: in start
    self._popen = self._Popen(self)
                  ^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/context.py:224: in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/context.py:300: in _Popen
    return Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/popen_forkserver.py:35: in __init__
    super().__init__(process_obj)
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/popen_fork.py:20: in __init__
    self._launch(process_obj)
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/popen_forkserver.py:47: in _launch
    reduction.dump(process_obj, buf)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <Process name='Process-1' parent=2756 initial>
file = <_io.BytesIO object at 0x7ff026975c10>, protocol = None

    def dump(obj, file, protocol=None):
        '''Replacement for pickle.dump() using ForkingPickler.'''
>       ForkingPickler(file, protocol).dump(obj)
E       _pickle.PicklingError: Can't pickle <function brewery_factory at 0x7ff026b70930>: it's not the same object as test_parallel_task.brewery_factory
E       when serializing dict item '_ctx_func'
E       when serializing exasol.pytest_backend.parallel_task._ParallelGenCtxManager state
E       when serializing exasol.pytest_backend.parallel_task._ParallelGenCtxManager object
E       when serializing tuple item 0
E       when serializing method reconstructor arguments
E       when serializing method object
E       when serializing dict item '_target'
E       when serializing multiprocessing.context.Process state
E       when serializing multiprocessing.context.Process object

/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/reduction.py:60: PicklingError
_______________________________ test_div_by_zero _______________________________

    def test_div_by_zero():
        with pytest.raises(RuntimeError) as ex_info:
>           with my_div(10, 0) as my_div_async:
                 ^^^^^^^^^^^^^

test/unit/test_parallel_task.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
exasol/pytest_backend/parallel_task.py:43: in __enter__
    self._proc.start()
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/process.py:121: in start
    self._popen = self._Popen(self)
                  ^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/context.py:224: in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/context.py:300: in _Popen
    return Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/popen_forkserver.py:35: in __init__
    super().__init__(process_obj)
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/popen_fork.py:20: in __init__
    self._launch(process_obj)
/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/popen_forkserver.py:47: in _launch
    reduction.dump(process_obj, buf)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <Process name='Process-2' parent=2756 initial>
file = <_io.BytesIO object at 0x7ff029efd210>, protocol = None

    def dump(obj, file, protocol=None):
        '''Replacement for pickle.dump() using ForkingPickler.'''
>       ForkingPickler(file, protocol).dump(obj)
E       _pickle.PicklingError: Can't pickle <function my_div at 0x7ff026995f30>: it's not the same object as test_parallel_task.my_div
E       when serializing dict item '_ctx_func'
E       when serializing exasol.pytest_backend.parallel_task._ParallelGenCtxManager state
E       when serializing exasol.pytest_backend.parallel_task._ParallelGenCtxManager object
E       when serializing tuple item 0
E       when serializing method reconstructor arguments
E       when serializing method object
E       when serializing dict item '_target'
E       when serializing multiprocessing.context.Process state
E       when serializing multiprocessing.context.Process object

/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/multiprocessing/reduction.py:60: PicklingError
=========================== short test summary info ============================
FAILED test/unit/test_parallel_task.py::test_my_brewery - _pickle.PicklingError: Can't pickle <function brewery_factory at 0x7ff026b70930>: it's not the same object as test_parallel_task.brewery_factory
when serializing dict item '_ctx_func'
when serializing exasol.pytest_backend.parallel_task._ParallelGenCtxManager state
when serializing exasol.pytest_backend.parallel_task._ParallelGenCtxManager object
when serializing tuple item 0
when serializing method reconstructor arguments
when serializing method object
when serializing dict item '_target'
when serializing multiprocessing.context.Process state
when serializing multiprocessing.context.Process object
FAILED test/unit/test_parallel_task.py::test_div_by_zero - _pickle.PicklingError: Can't pickle <function my_div at 0x7ff026995f30>: it's not the same object as test_parallel_task.my_div
when serializing dict item '_ctx_func'
when serializing exasol.pytest_backend.parallel_task._ParallelGenCtxManager state
when serializing exasol.pytest_backend.parallel_task._ParallelGenCtxManager object
when serializing tuple item 0
when serializing method reconstructor arguments
when serializing method object
when serializing dict item '_target'
when serializing multiprocessing.context.Process state
when serializing multiprocessing.context.Process object

To Do

  • Figure out what is causing the issue
  • Resolve issue
  • Update pyproject.toml to include Python <4 (not <3.14)
  • Remove python_versions defined in PROJECT_CONFIG of noxconfig.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactoringCode improvement without behavior change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions