We're sunsetting PodQuest on 2025-07-28. Thank you for your support!
Export Podcast Subscriptions
cover of episode pytest-repeat - works fine on Python 3.14

pytest-repeat - works fine on Python 3.14

2025/4/10
logo of podcast Test & Code

Test & Code

AI Deep Dive AI Chapters Transcript
People
主持人
专注于电动车和能源领域的播客主持人和内容创作者。
Topics
主持人:pytest-repeat 插件在 Python 3.14 版本上运行良好,并且已经在 Python 3.9 到 3.14 版本上进行了测试。该插件允许重复运行测试,可以通过命令行参数 `--count` 和 `--repeat-scope` 来控制重复次数和范围,也可以使用装饰器 `@pytest.mark.repeat` 来指定单个测试的重复次数。对于查找间歇性测试失败,建议设置较大的重复次数,并结合 `--xfail` 参数使用,以便在测试失败时能够及时发现并调试。 此外,我解释了之前发布的关于 pytest-repeat 在 Python 3.14 上不工作的愚人节玩笑。这个玩笑利用了 Python 3.14 版本号与圆周率 π 的开头数字相同的巧合,以及 π 是无理数且不会重复的特点,与 pytest-repeat 的重复功能形成对比。虽然这个玩笑并不十分成功,但我希望能够在以后的愚人节尝试更好的玩笑。 最后,我介绍了 pytest-repeat 插件的最新版本更新,该版本主要更新了测试范围,现在涵盖 Python 3.13 和 3.14 版本。

Deep Dive

Chapters
This chapter covers the pytest-repeat plugin, its functionality for repeating tests, different usage methods with command-line options and decorators, and strategies for identifying intermittent test failures. It emphasizes the plugin's compatibility with various Python versions, including 3.14.
  • pytest-repeat works on Python 3.14 and versions 3.9-3.14.
  • It allows repeating tests using command-line options (--count) or decorators (@pytest.mark.repeat).
  • Repeating tests helps identify intermittent failures by running tests multiple times. Using --count with repeat scope=session and -x can pinpoint failures.

Shownotes Transcript

pytest-repeat 

  • is a pytest plugin that makes it easy to repeat a single test, or multiple tests, a specific number of times.  
  • works fine on Python 3.14
  • is tested on Python 3.9-3.14
  • probably works fine still on 3.7 & 3.8

This episode also discusses the attempted April Fools episode.

Links:

**Sponsored by: **

  • The Complete pytest course) is now a bundle, with each part available separately.

  • pytest Primary Power) teaches the super powers of pytest that you need to learn to use pytest effectively.

  • Using pytest with Projects) has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CI

  • Then pytest Booster Rockets) can help with advanced parametrization and building plugins.

  • Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest) has a course for you.

** ★ Support this podcast on Patreon ★) **