Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
Python interview question
Parallelism & flaky testsMiddleVery commonTroubleshooting

A Python automation test is flaky only in CI or under parallel execution. How do you investigate it instead of just adding retries?

Answer

First make the failure observable: preserve traceback, logs, request/response evidence, browser trace or screenshot, test seed and worker identity. Reproduce with the same environment and execution mode, then test the common causes systematically: fixed sleeps, stale or brittle locators, shared state, test-order dependence, data collisions, asynchronous completion and environment instability. Quarantine a known flaky test from a blocking gate if necessary, but keep ownership and a fix deadline; retries may reduce disruption only when they are visible and measured, never as the root-cause strategy.

Strong answer includes

  • collects enough CI evidence to reproduce the exact failing conditions
  • investigates timing, shared state, ordering, selectors and environment instead of assuming product failure
  • treats quarantine or retries as controlled mitigation with ownership, not the fix

Practical example

A checkout test passes locally but fails 3% of the time on four CI workers. The trace shows two workers reuse the same cart account and overwrite each other's state. Creating isolated users removes the flake; adding

Python example
reruns=3

would only have hidden the race and made the pipeline look healthier than it was.

#pytest#flaky-tests#ci#troubleshooting

Sources

pytest documentationpytest · Fixture scope, parametrization, markers and plugin architecture50 SDET Interview Questions (With Sample Answers) 2026sdet.qa · 2026 recurrence signal for framework design, test-data isolation, flaky-test handling, API testing and practical codingThe Complete 2026 SDET Interview Preparation GuideScrollTest · 2026 interview signal for Selenium dynamic elements, Playwright, framework design, test data and CI-oriented automationStrong Middle / Senior Automation Test Engineer (Python)ELEKS via DOU Jobs · 2026 Ukrainian-market evidence for Python framework design, Selenium, Playwright, REST, CI/CD, flake-rate ownership and test-layer architecture