[Python] django tests - error in github action while running in parallel

Discussão em 'Python' iniciado por Stack, Julho 31, 2025.

  1. Stack

    Stack Membro Participativo

    in a github action yml file it's defined this step to run django tests:

    python manage.py test --failfast --parallel 2


    looks like --parallel 2 breaks it:

    multiprocessing.pool.RemoteTraceback:
    """
    Traceback (most recent call last):
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/test/runner.py", line 449, in _run_subsuite
    result = runner.run(subsuite)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/test/runner.py", line 366, in run
    test(result)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/unittest/suite.py", line 84, in __call__
    return self.run(*args, **kwds)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/unittest/suite.py", line 122, in run
    test(result)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/test/testcases.py", line 381, in __call__
    self._setup_and_call(result)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/test/testcases.py", line 416, in _setup_and_call
    super().__call__(result)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/unittest/case.py", line 650, in __call__
    return self.run(*args, **kwds)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/unittest/case.py", line 599, in run
    self._feedErrorsToResult(result, outcome.errors)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/unittest/case.py", line 516, in _feedErrorsToResult
    result.addFailure(test, exc_info)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/test/runner.py", line 296, in addFailure
    self.check_picklable(test, err)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/test/runner.py", line 216, in check_picklable
    self._confirm_picklable(err)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/test/runner.py", line 186, in _confirm_picklable
    pickle.loads(pickle.dumps(obj))
    TypeError: cannot pickle 'traceback' object
    """

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
    File "/home/runner/work/fiscozen/fiscozen/fiscozen_django/manage.py", line 24, in <module>
    execute_from_command_line(sys.argv)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/core/management/commands/test.py", line 24, in run_from_argv
    super().run_from_argv(argv)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/core/management/commands/test.py", line 68, in handle
    failures = test_runner.run_tests(test_labels)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/test/runner.py", line 1061, in run_tests
    result = self.run_suite(suite)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/test/runner.py", line 983, in run_suite
    return runner.run(suite)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/unittest/runner.py", line 184, in run
    test(result)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/unittest/suite.py", line 84, in __call__
    return self.run(*args, **kwds)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/django/test/runner.py", line 534, in run
    subsuite_index, events = test_results.next(timeout=0.1)
    File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/multiprocessing/pool.py", line 873, in next
    raise value
    TypeError: cannot pickle 'traceback' object
    Error: Process completed with exit code 1.


    anybody experienced it?

    Continue reading...

Compartilhe esta Página