From 1d0168b47102587fd790c381eb860f39f72549fc Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sun, 22 Dec 2024 10:37:04 -0500 Subject: [PATCH] Use sys.executable rather than "python" to invoke pytest This supports environments where the Python interpreter is not named "python". For example, in Fedora it is "python3" unless the python-unversioned-command package is installed. --- src/inline_snapshot/testing/_example.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/inline_snapshot/testing/_example.py b/src/inline_snapshot/testing/_example.py index 60d3b55..4a9948c 100644 --- a/src/inline_snapshot/testing/_example.py +++ b/src/inline_snapshot/testing/_example.py @@ -5,6 +5,7 @@ import platform import re import subprocess as sp +import sys import traceback from argparse import ArgumentParser from io import StringIO @@ -263,7 +264,7 @@ def run_pytest( tmp_path = Path(dir) self._write_files(tmp_path) - cmd = ["python", "-m", "pytest", *args] + cmd = [sys.executable, "-m", "pytest", *args] term_columns = 80