Skip to content

Keycode

More flesh, less fluff.

Month: March 2026

How to check the root cause of the difference between “pytest” and “python -m pytest”?

CommandUses which Python?Risk
pytestWhatever executable is first in PATHMay run wrong environment
python -m pytestThe Python you explicitly calledMuch safer
cat $(which pytest)

The shebang line can show which “python” that pytest uses.

python -c "import sys; print(sys.executable)"

or

which python

This shows the interpreter you’re explicitly invoking.

Author pashanhuPosted on 09/03/202609/03/2026Categories PythonTags pytestLeave a comment on How to check the root cause of the difference between “pytest” and “python -m pytest”?

Recent Posts

  • How to check the root cause of the difference between “pytest” and “python -m pytest”?
  • Null response caused by an extra space
  • Use getrusage() to check memory usage
  • unittest setUp vs. pytest setup_class
  • Install pytorch cpu only

Recent Comments

No comments to show.
  • March 2026
  • December 2025
  • October 2025
  • August 2025
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • August 2021
  • November 2020
  • October 2020
  • June 2020
  • May 2020
  • February 2020
  • October 2019
  • September 2019
  • August 2019
  • Algorithm
  • AWS
  • Boost
  • C/C++
  • Debug
  • git
  • GitHub
  • GTest
  • Image/Graphics
  • Java
  • Linux
  • Node.js
  • Other
  • Python
  • Qt
  • Swift
  • Unreal Engine
Keycode Proudly powered by WordPress