From 3ec1c9d2a77fcd1bd2cb5d9824c3f38a264f26e3 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 29 Oct 2025 11:53:43 +0100 Subject: [PATCH] tests: more output for testbed inits Signed-off-by: Jan Kowalleck --- .../infiles/environment/editable-self/init.py | 14 ++++++-------- tests/_data/infiles/environment/local/init.py | 14 ++++++-------- .../environment/normalize-packagename/init.py | 14 ++++++-------- .../infiles/environment/private-packages/init.py | 10 ++++------ tests/_data/infiles/environment/via-pdm/init.py | 10 ++++------ tests/_data/infiles/environment/via-pipenv/init.py | 10 ++++------ tests/_data/infiles/environment/via-poetry/init.py | 11 ++++------- tests/_data/infiles/environment/via-uv/init.py | 10 ++++------ .../_data/infiles/environment/with-extras/init.py | 12 +++++------- .../environment/with-license-pep639/init.py | 12 +++++------- .../infiles/environment/with-license-text/init.py | 12 +++++------- tests/_data/infiles/environment/with-urls/init.py | 12 +++++------- 12 files changed, 58 insertions(+), 83 deletions(-) diff --git a/tests/_data/infiles/environment/editable-self/init.py b/tests/_data/infiles/environment/editable-self/init.py index 1b66d2138..0a7afafa3 100644 --- a/tests/_data/infiles/environment/editable-self/init.py +++ b/tests/_data/infiles/environment/editable-self/init.py @@ -22,7 +22,7 @@ from os import name as os_name from os.path import dirname, join from subprocess import check_call # nosec:B404 -from sys import executable +from sys import executable, stderr from venv import EnvBuilder __all__ = ['main'] @@ -33,13 +33,11 @@ def pip_install(*args: str) -> None: # pip is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'pip', - '--python', env_dir, - 'install', '--require-virtualenv', '--no-input', '--progress-bar=off', '--no-color', - *args - ) - print('+ ', *call) + call = (executable, '-m', 'pip', + '--python', env_dir, + 'install', '--require-virtualenv', '--no-input', '--progress-bar=off', '--no-color', + *args) + print('+ ', *call, file=stderr) check_call(call, cwd=this_dir, shell=False) # nosec:B603 diff --git a/tests/_data/infiles/environment/local/init.py b/tests/_data/infiles/environment/local/init.py index e77d79772..062b9e663 100644 --- a/tests/_data/infiles/environment/local/init.py +++ b/tests/_data/infiles/environment/local/init.py @@ -22,7 +22,7 @@ from os import name as os_name from os.path import abspath, dirname, join from subprocess import check_call # nosec:B404 -from sys import executable +from sys import executable, stderr from venv import EnvBuilder __all__ = ['main'] @@ -35,13 +35,11 @@ def pip_install(*args: str) -> None: # pip is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'pip', - '--python', env_dir, - 'install', '--require-virtualenv', '--no-input', '--progress-bar=off', '--no-color', - *args - ) - print('+ ', *call) + call = (executable, '-m', 'pip', + '--python', env_dir, + 'install', '--require-virtualenv', '--no-input', '--progress-bar=off', '--no-color', + *args) + print('+ ', *call, file=stderr) check_call(call, cwd=this_dir, shell=False) # nosec:B603 diff --git a/tests/_data/infiles/environment/normalize-packagename/init.py b/tests/_data/infiles/environment/normalize-packagename/init.py index 65d1e3952..23672e575 100644 --- a/tests/_data/infiles/environment/normalize-packagename/init.py +++ b/tests/_data/infiles/environment/normalize-packagename/init.py @@ -22,7 +22,7 @@ from os import name as os_name from os.path import dirname, join from subprocess import PIPE, CompletedProcess, run # nosec:B404 -from sys import argv, executable +from sys import argv, executable, stderr from typing import Any from venv import EnvBuilder @@ -35,12 +35,10 @@ def pip_run(*args: str, **kwargs: Any) -> CompletedProcess: # pip is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'pip', - '--python', env_dir, - *args - ) - print('+ ', *call) + call = (executable, '-m', 'pip', + '--python', env_dir, + *args) + print('+ ', *call, file=stderr) res = run(call, **kwargs, cwd=this_dir, shell=False) # nosec:B603 if res.returncode != 0: raise RuntimeError('process failed') @@ -66,7 +64,7 @@ def main() -> None: '--no-deps', # the clib dep cannot be installed consistently... # https://packaging.python.org/en/latest/specifications/name-normalization/#name-normalization 'ruamel-YAML[jinja2]', # actually "ruamel.yaml", normalizes to "ruamel-yaml" - 'ruamel-Yaml.Jinja2', # actually "ruamel.yaml.jinja2", normalizes to "ruamel-yaml-jinja2" + 'ruamel-Yaml.Jinja2', # actually "ruamel.yaml.jinja2", normalizes to "ruamel-yaml-jinja2" ) diff --git a/tests/_data/infiles/environment/private-packages/init.py b/tests/_data/infiles/environment/private-packages/init.py index fa285057e..667cfc6c6 100644 --- a/tests/_data/infiles/environment/private-packages/init.py +++ b/tests/_data/infiles/environment/private-packages/init.py @@ -47,12 +47,10 @@ def pip_run(*args: str) -> CompletedProcess: # pip is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'pip', - '--python', env_dir, - *args - ) - print('+ ', *call) + call = (executable, '-m', 'pip', + '--python', env_dir, + *args) + print('+ ', *call, file=stderr) res = run(call, cwd=this_dir, shell=False) # nosec:B603 if res.returncode != 0: raise RuntimeError('process failed') diff --git a/tests/_data/infiles/environment/via-pdm/init.py b/tests/_data/infiles/environment/via-pdm/init.py index 6b05cebb9..b8362fbcc 100644 --- a/tests/_data/infiles/environment/via-pdm/init.py +++ b/tests/_data/infiles/environment/via-pdm/init.py @@ -23,7 +23,7 @@ from os.path import dirname, join from shutil import rmtree from subprocess import CompletedProcess, run # nosec:B404 -from sys import executable +from sys import executable, stderr __all__ = ['main'] @@ -37,11 +37,9 @@ def pdm_run(*args: str) -> CompletedProcess: # PDM is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'pdm', - *args - ) - print('+ ', *call) + call = (executable, '-m', 'pdm', + *args) + print('+ ', *call, file=stderr) res = run(call, cwd=this_dir, env=pdm_env, shell=False) # nosec:B603 if res.returncode != 0: raise RuntimeError('process failed') diff --git a/tests/_data/infiles/environment/via-pipenv/init.py b/tests/_data/infiles/environment/via-pipenv/init.py index 20bb1d3b4..56f388df3 100644 --- a/tests/_data/infiles/environment/via-pipenv/init.py +++ b/tests/_data/infiles/environment/via-pipenv/init.py @@ -23,7 +23,7 @@ from os.path import dirname, join from shutil import rmtree from subprocess import CompletedProcess, run # nosec:B404 -from sys import executable +from sys import executable, stderr from typing import Any __all__ = ['main'] @@ -40,11 +40,9 @@ def pipenv_run(*args: str) -> CompletedProcess: # pipenv is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'pipenv', - *args - ) - print('+ ', *call) + call = (executable, '-m', 'pipenv', + *args) + print('+ ', *call, file=stderr) res = run(call, cwd=this_dir, env=pipenv_env, shell=False) # nosec:B603 if res.returncode != 0: raise RuntimeError('process failed') diff --git a/tests/_data/infiles/environment/via-poetry/init.py b/tests/_data/infiles/environment/via-poetry/init.py index 7634c7ae2..51eccad4c 100644 --- a/tests/_data/infiles/environment/via-poetry/init.py +++ b/tests/_data/infiles/environment/via-poetry/init.py @@ -22,24 +22,21 @@ from os import environ from os.path import dirname from subprocess import CompletedProcess, run # nosec:B404 -from sys import executable +from sys import executable, stderr __all__ = ['main'] this_dir = dirname(__file__) - poetry_env = environ.copy() poetry_env['VIRTUAL_ENV'] = '' def poetry_run(*args: str) -> CompletedProcess: # Poetry is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'poetry', - *args - ) - print('+ ', *call) + call = (executable, '-m', 'poetry', + *args) + print('+ ', *call, file=stderr) res = run(call, cwd=this_dir, env=poetry_env, shell=False) # nosec:B603 if res.returncode != 0: raise RuntimeError('process failed') diff --git a/tests/_data/infiles/environment/via-uv/init.py b/tests/_data/infiles/environment/via-uv/init.py index 67db2a556..d5dba2082 100644 --- a/tests/_data/infiles/environment/via-uv/init.py +++ b/tests/_data/infiles/environment/via-uv/init.py @@ -23,7 +23,7 @@ from os.path import dirname, join from shutil import rmtree from subprocess import CompletedProcess, run # nosec:B404 -from sys import executable +from sys import executable, stderr __all__ = ['main'] @@ -37,11 +37,9 @@ def uv_run(*args: str) -> CompletedProcess: # uv is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'uv', - *args - ) - print('+ ', *call) + call = (executable, '-m', 'uv', + *args) + print('+ ', *call, file=stderr) res = run(call, cwd=this_dir, env=uv_env, shell=False) # nosec:B603 if res.returncode != 0: raise RuntimeError('process failed') diff --git a/tests/_data/infiles/environment/with-extras/init.py b/tests/_data/infiles/environment/with-extras/init.py index a50cc6662..a199f3bd0 100644 --- a/tests/_data/infiles/environment/with-extras/init.py +++ b/tests/_data/infiles/environment/with-extras/init.py @@ -22,7 +22,7 @@ from os import name as os_name from os.path import dirname, isdir, join from subprocess import PIPE, CompletedProcess, run # nosec:B404 -from sys import argv, executable, version_info +from sys import argv, executable, stderr, version_info from typing import Any from venv import EnvBuilder @@ -35,12 +35,10 @@ def pip_run(*args: str, **kwargs: Any) -> CompletedProcess: # pip is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'pip', - '--python', env_dir, - *args - ) - print('+ ', *call) + call = (executable, '-m', 'pip', + '--python', env_dir, + *args) + print('+ ', *call, file=stderr) res = run(call, **kwargs, cwd=this_dir, shell=False) # nosec:B603 if res.returncode != 0: raise RuntimeError('process failed') diff --git a/tests/_data/infiles/environment/with-license-pep639/init.py b/tests/_data/infiles/environment/with-license-pep639/init.py index 13ae93493..ec164abf2 100644 --- a/tests/_data/infiles/environment/with-license-pep639/init.py +++ b/tests/_data/infiles/environment/with-license-pep639/init.py @@ -22,7 +22,7 @@ from os import name as os_name from os.path import dirname, join from subprocess import PIPE, CompletedProcess, run # nosec:B404 -from sys import argv, executable +from sys import argv, executable, stderr from typing import Any from venv import EnvBuilder @@ -35,12 +35,10 @@ def pip_run(*args: str, **kwargs: Any) -> CompletedProcess: # pip is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'pip', - '--python', env_dir, - *args - ) - print('+ ', *call) + call = (executable, '-m', 'pip', + '--python', env_dir, + *args) + print('+ ', *call, file=stderr) res = run(call, **kwargs, cwd=this_dir, shell=False) # nosec:B603 if res.returncode != 0: raise RuntimeError('process failed') diff --git a/tests/_data/infiles/environment/with-license-text/init.py b/tests/_data/infiles/environment/with-license-text/init.py index 4cb7c3749..1289b2e2d 100644 --- a/tests/_data/infiles/environment/with-license-text/init.py +++ b/tests/_data/infiles/environment/with-license-text/init.py @@ -22,7 +22,7 @@ from os import name as os_name from os.path import abspath, dirname, join from subprocess import CompletedProcess, run # nosec:B404 -from sys import executable +from sys import executable, stderr from typing import Any from venv import EnvBuilder @@ -37,12 +37,10 @@ def pip_run(*args: str, **kwargs: Any) -> CompletedProcess: # pip is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'pip', - '--python', env_dir, - *args - ) - print('+ ', *call) + call = (executable, '-m', 'pip', + '--python', env_dir, + *args) + print('+ ', *call, file=stderr) res = run(call, **kwargs, cwd=this_dir, shell=False) # nosec:B603 if res.returncode != 0: raise RuntimeError('process failed') diff --git a/tests/_data/infiles/environment/with-urls/init.py b/tests/_data/infiles/environment/with-urls/init.py index 52833bd3c..a4ce18650 100644 --- a/tests/_data/infiles/environment/with-urls/init.py +++ b/tests/_data/infiles/environment/with-urls/init.py @@ -22,7 +22,7 @@ from os import name as os_name from os.path import dirname, join from subprocess import CompletedProcess, run # nosec:B404 -from sys import executable +from sys import executable, stderr from venv import EnvBuilder __all__ = ['main'] @@ -33,12 +33,10 @@ def pip_run(*args: str) -> CompletedProcess: # pip is not API, but a CLI -- call it like that! - call = ( - executable, '-m', 'pip', - '--python', env_dir, - *args - ) - print('+ ', *call) + call = (executable, '-m', 'pip', + '--python', env_dir, + *args) + print('+ ', *call, file=stderr) res = run(call, cwd=this_dir, shell=False) # nosec:B603 if res.returncode != 0: raise RuntimeError('process failed')