Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: Can't pickle local object 'lazy_call.<locals>._handler' #22

Open
amirse opened this issue Oct 8, 2024 · 2 comments
Open
Labels

Comments

@amirse
Copy link

amirse commented Oct 8, 2024

Hey there,
Running inside Github actions, using Poetry, I get this error:

packages/unittest_parallel/main.py", line 114, in main
    results = pool.map(test_manager.run_tests, test_suites)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/multiprocessing/pool.py", line 367, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/multiprocessing/pool.py", line 540, in _handle_tasks
    put(task)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/multiprocessing/connection.py", line 206, in send
    self._send_bytes(_ForkingPickler.dumps(obj))
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/multiprocessing/reduction.py", line 51, in dumps
    cls(buf, protocol).dump(obj)
AttributeError: Can't pickle local object 'lazy_call.<locals>._handler'

I quick search came up with this which suggests changing the process forking type from spawn to fork.
I tried changing multiprocessing_context = multiprocessing.get_context(method='spawn') to fork but it didn't help.
I should mention that this is running on a runner using arm64, not x86_64...
Any thoughts on this?
The command line was very simple:
poetry run unittest-parallel -s <some_dir_with_tests>

thanks!

@amirse
Copy link
Author

amirse commented Oct 8, 2024

Hmm, OK nevermind about the arm64, since I just tried running the test on my machine and it's an x86_64 Ubuntu 24.04. Same deal..

@craigahobbs
Copy link
Owner

A couple of thoughts:

Does the error happen every test run, or is it occasional, like #15? Does the issue happen in Python 3.11 or 3.12?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants