Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Django's parallel test runner crashes with TypeError: cannot pickle 'traceback' object when Selenium tests fail because Selenium exception tracebacks contain unpicklable objects like WebDriver instances.

Changes

  • Added tblib = "^3.0.0" to dev dependencies in pyproject.toml
  • Updated poetry.lock to include tblib 3.2.2 with proper hash verification

Technical Details

When using --parallel, Django's test runner spawns worker processes via multiprocessing. Failed test exceptions must be pickled to communicate back to the main process. Without tblib, complex tracebacks (particularly from Selenium's TimeoutException) cannot be serialized, crashing the entire suite instead of reporting the failure.

Django detects tblib automatically and uses it to serialize tracebacks. This is the official Django recommendation (see error message from PR #5295).

Impact

  • Test failures now report properly instead of crashing the suite
  • CI/CD can complete when Selenium tests timeout
  • Zero code changes required - Django handles integration
Original prompt

Fix the flaky tests see this for more info #5295


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 15, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Note

Free review on us!

CodeRabbit is offering free reviews until Wed Dec 17 2025 to showcase some of the refinements we've made.

Comment @coderabbitai help to get the list of available commands and usage tips.

@DonnieBLT DonnieBLT marked this pull request as ready for review December 15, 2025 09:58
Copilot AI review requested due to automatic review settings December 15, 2025 09:58
@github-actions github-actions bot added files-changed: 1 pre-commit: passed Pre-commit checks passed labels Dec 15, 2025
Copilot AI changed the title [WIP] Fix flaky tests identified in issue tracking Add tblib to fix parallel test runner crashes on Selenium exceptions Dec 15, 2025
Copilot AI requested a review from DonnieBLT December 15, 2025 10:02
@github-actions github-actions bot added the tests: passed Django tests passed label Dec 15, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses test execution issues by adding the tblib (traceback library) package as a dev dependency. The purpose is to fix crashes that occur when running Django tests with the --parallel flag, specifically when Selenium tests fail with unpicklable exception tracebacks. Django's parallel test runner uses multiprocessing to distribute tests across worker processes, and tblib enables proper serialization of complex tracebacks (like those from Selenium exceptions) so they can be sent back to the main process for reporting.

Key Changes:

  • Added tblib = "^3.0.0" to the Poetry dev dependencies in pyproject.toml

@DonnieBLT
Copy link
Collaborator

@copilot update poetry lock file

Copy link
Contributor Author

Copilot AI commented Dec 15, 2025

@copilot update poetry lock file

Done. Updated poetry.lock with tblib 3.2.2 in commit 4099b80.

@github-actions github-actions bot added the last-active: 0d PR last updated 0 days ago label Dec 16, 2025
@github-actions github-actions bot added files-changed: 2 PR changes 2 files tests: failed Django tests failed and removed files-changed: 1 last-active: 0d PR last updated 0 days ago tests: passed Django tests passed labels Dec 16, 2025
@github-actions github-actions bot added tests: passed Django tests passed last-active: 0d PR last updated 0 days ago last-active: 2d PR last updated 2 days ago and removed tests: failed Django tests failed last-active: 0d PR last updated 0 days ago last-active: 2d PR last updated 2 days ago labels Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 2 PR changes 2 files last-active: 0d PR last updated 0 days ago pre-commit: passed Pre-commit checks passed tests: passed Django tests passed

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants