Pytest Fails on Build Server but Passes Locally: How to Simulate Slower Environment?

56 Views Asked by At

I'm encountering an issue where some tests in Pytest are failing when run on a build server, but they pass without any issues on my local workstation. I suspect these failures are related to slower load and/or processing times on the build server compared to my local environment.

To better understand and resolve these failures, I am looking to replicate the build server's slower environment on my local setup. My aim is to mimic slower processing speeds or network latencies to reproduce the test failures locally, which would help me to debug them more effectively.

Here are my specific questions:

  • Is there a way to artificially limit processing speed when running Pytest on a local machine to simulate a slower CPU?
  • Can network speed be throttled in a controlled manner during test execution to mimic slower network conditions?
  • Are there any recommended practices or tools for replicating a slower test environment that would closely match the conditions of a build server?

Any insights or suggestions on how to approach this issue would be greatly appreciated. If relevant, please include code snippets or tool recommendations.

0

There are 0 best solutions below