Skip to content

Commit 821f31c

Browse files
authored
tests: more output for testbed inits (#988)
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 10b3bdb commit 821f31c

File tree

12 files changed

+58
-83
lines changed

12 files changed

+58
-83
lines changed

tests/_data/infiles/environment/editable-self/init.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from os import name as os_name
2323
from os.path import dirname, join
2424
from subprocess import check_call # nosec:B404
25-
from sys import executable
25+
from sys import executable, stderr
2626
from venv import EnvBuilder
2727

2828
__all__ = ['main']
@@ -33,13 +33,11 @@
3333

3434
def pip_install(*args: str) -> None:
3535
# pip is not API, but a CLI -- call it like that!
36-
call = (
37-
executable, '-m', 'pip',
38-
'--python', env_dir,
39-
'install', '--require-virtualenv', '--no-input', '--progress-bar=off', '--no-color',
40-
*args
41-
)
42-
print('+ ', *call)
36+
call = (executable, '-m', 'pip',
37+
'--python', env_dir,
38+
'install', '--require-virtualenv', '--no-input', '--progress-bar=off', '--no-color',
39+
*args)
40+
print('+ ', *call, file=stderr)
4341
check_call(call, cwd=this_dir, shell=False) # nosec:B603
4442

4543

tests/_data/infiles/environment/local/init.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from os import name as os_name
2323
from os.path import abspath, dirname, join
2424
from subprocess import check_call # nosec:B404
25-
from sys import executable
25+
from sys import executable, stderr
2626
from venv import EnvBuilder
2727

2828
__all__ = ['main']
@@ -35,13 +35,11 @@
3535

3636
def pip_install(*args: str) -> None:
3737
# pip is not API, but a CLI -- call it like that!
38-
call = (
39-
executable, '-m', 'pip',
40-
'--python', env_dir,
41-
'install', '--require-virtualenv', '--no-input', '--progress-bar=off', '--no-color',
42-
*args
43-
)
44-
print('+ ', *call)
38+
call = (executable, '-m', 'pip',
39+
'--python', env_dir,
40+
'install', '--require-virtualenv', '--no-input', '--progress-bar=off', '--no-color',
41+
*args)
42+
print('+ ', *call, file=stderr)
4543
check_call(call, cwd=this_dir, shell=False) # nosec:B603
4644

4745

tests/_data/infiles/environment/normalize-packagename/init.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from os import name as os_name
2323
from os.path import dirname, join
2424
from subprocess import PIPE, CompletedProcess, run # nosec:B404
25-
from sys import argv, executable
25+
from sys import argv, executable, stderr
2626
from typing import Any
2727
from venv import EnvBuilder
2828

@@ -35,12 +35,10 @@
3535

3636
def pip_run(*args: str, **kwargs: Any) -> CompletedProcess:
3737
# pip is not API, but a CLI -- call it like that!
38-
call = (
39-
executable, '-m', 'pip',
40-
'--python', env_dir,
41-
*args
42-
)
43-
print('+ ', *call)
38+
call = (executable, '-m', 'pip',
39+
'--python', env_dir,
40+
*args)
41+
print('+ ', *call, file=stderr)
4442
res = run(call, **kwargs, cwd=this_dir, shell=False) # nosec:B603
4543
if res.returncode != 0:
4644
raise RuntimeError('process failed')
@@ -66,7 +64,7 @@ def main() -> None:
6664
'--no-deps', # the clib dep cannot be installed consistently...
6765
# https://packaging.python.org/en/latest/specifications/name-normalization/#name-normalization
6866
'ruamel-YAML[jinja2]', # actually "ruamel.yaml", normalizes to "ruamel-yaml"
69-
'ruamel-Yaml.Jinja2', # actually "ruamel.yaml.jinja2", normalizes to "ruamel-yaml-jinja2"
67+
'ruamel-Yaml.Jinja2', # actually "ruamel.yaml.jinja2", normalizes to "ruamel-yaml-jinja2"
7068
)
7169

7270

tests/_data/infiles/environment/private-packages/init.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@
4747

4848
def pip_run(*args: str) -> CompletedProcess:
4949
# pip is not API, but a CLI -- call it like that!
50-
call = (
51-
executable, '-m', 'pip',
52-
'--python', env_dir,
53-
*args
54-
)
55-
print('+ ', *call)
50+
call = (executable, '-m', 'pip',
51+
'--python', env_dir,
52+
*args)
53+
print('+ ', *call, file=stderr)
5654
res = run(call, cwd=this_dir, shell=False) # nosec:B603
5755
if res.returncode != 0:
5856
raise RuntimeError('process failed')

tests/_data/infiles/environment/via-pdm/init.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from os.path import dirname, join
2424
from shutil import rmtree
2525
from subprocess import CompletedProcess, run # nosec:B404
26-
from sys import executable
26+
from sys import executable, stderr
2727

2828
__all__ = ['main']
2929

@@ -37,11 +37,9 @@
3737

3838
def pdm_run(*args: str) -> CompletedProcess:
3939
# PDM is not API, but a CLI -- call it like that!
40-
call = (
41-
executable, '-m', 'pdm',
42-
*args
43-
)
44-
print('+ ', *call)
40+
call = (executable, '-m', 'pdm',
41+
*args)
42+
print('+ ', *call, file=stderr)
4543
res = run(call, cwd=this_dir, env=pdm_env, shell=False) # nosec:B603
4644
if res.returncode != 0:
4745
raise RuntimeError('process failed')

tests/_data/infiles/environment/via-pipenv/init.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from os.path import dirname, join
2424
from shutil import rmtree
2525
from subprocess import CompletedProcess, run # nosec:B404
26-
from sys import executable
26+
from sys import executable, stderr
2727
from typing import Any
2828

2929
__all__ = ['main']
@@ -40,11 +40,9 @@
4040

4141
def pipenv_run(*args: str) -> CompletedProcess:
4242
# pipenv is not API, but a CLI -- call it like that!
43-
call = (
44-
executable, '-m', 'pipenv',
45-
*args
46-
)
47-
print('+ ', *call)
43+
call = (executable, '-m', 'pipenv',
44+
*args)
45+
print('+ ', *call, file=stderr)
4846
res = run(call, cwd=this_dir, env=pipenv_env, shell=False) # nosec:B603
4947
if res.returncode != 0:
5048
raise RuntimeError('process failed')

tests/_data/infiles/environment/via-poetry/init.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,21 @@
2222
from os import environ
2323
from os.path import dirname
2424
from subprocess import CompletedProcess, run # nosec:B404
25-
from sys import executable
25+
from sys import executable, stderr
2626

2727
__all__ = ['main']
2828

2929
this_dir = dirname(__file__)
3030

31-
3231
poetry_env = environ.copy()
3332
poetry_env['VIRTUAL_ENV'] = ''
3433

3534

3635
def poetry_run(*args: str) -> CompletedProcess:
3736
# Poetry is not API, but a CLI -- call it like that!
38-
call = (
39-
executable, '-m', 'poetry',
40-
*args
41-
)
42-
print('+ ', *call)
37+
call = (executable, '-m', 'poetry',
38+
*args)
39+
print('+ ', *call, file=stderr)
4340
res = run(call, cwd=this_dir, env=poetry_env, shell=False) # nosec:B603
4441
if res.returncode != 0:
4542
raise RuntimeError('process failed')

tests/_data/infiles/environment/via-uv/init.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from os.path import dirname, join
2424
from shutil import rmtree
2525
from subprocess import CompletedProcess, run # nosec:B404
26-
from sys import executable
26+
from sys import executable, stderr
2727

2828
__all__ = ['main']
2929

@@ -37,11 +37,9 @@
3737

3838
def uv_run(*args: str) -> CompletedProcess:
3939
# uv is not API, but a CLI -- call it like that!
40-
call = (
41-
executable, '-m', 'uv',
42-
*args
43-
)
44-
print('+ ', *call)
40+
call = (executable, '-m', 'uv',
41+
*args)
42+
print('+ ', *call, file=stderr)
4543
res = run(call, cwd=this_dir, env=uv_env, shell=False) # nosec:B603
4644
if res.returncode != 0:
4745
raise RuntimeError('process failed')

tests/_data/infiles/environment/with-extras/init.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from os import name as os_name
2323
from os.path import dirname, isdir, join
2424
from subprocess import PIPE, CompletedProcess, run # nosec:B404
25-
from sys import argv, executable, version_info
25+
from sys import argv, executable, stderr, version_info
2626
from typing import Any
2727
from venv import EnvBuilder
2828

@@ -35,12 +35,10 @@
3535

3636
def pip_run(*args: str, **kwargs: Any) -> CompletedProcess:
3737
# pip is not API, but a CLI -- call it like that!
38-
call = (
39-
executable, '-m', 'pip',
40-
'--python', env_dir,
41-
*args
42-
)
43-
print('+ ', *call)
38+
call = (executable, '-m', 'pip',
39+
'--python', env_dir,
40+
*args)
41+
print('+ ', *call, file=stderr)
4442
res = run(call, **kwargs, cwd=this_dir, shell=False) # nosec:B603
4543
if res.returncode != 0:
4644
raise RuntimeError('process failed')

tests/_data/infiles/environment/with-license-pep639/init.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from os import name as os_name
2323
from os.path import dirname, join
2424
from subprocess import PIPE, CompletedProcess, run # nosec:B404
25-
from sys import argv, executable
25+
from sys import argv, executable, stderr
2626
from typing import Any
2727
from venv import EnvBuilder
2828

@@ -35,12 +35,10 @@
3535

3636
def pip_run(*args: str, **kwargs: Any) -> CompletedProcess:
3737
# pip is not API, but a CLI -- call it like that!
38-
call = (
39-
executable, '-m', 'pip',
40-
'--python', env_dir,
41-
*args
42-
)
43-
print('+ ', *call)
38+
call = (executable, '-m', 'pip',
39+
'--python', env_dir,
40+
*args)
41+
print('+ ', *call, file=stderr)
4442
res = run(call, **kwargs, cwd=this_dir, shell=False) # nosec:B603
4543
if res.returncode != 0:
4644
raise RuntimeError('process failed')

0 commit comments

Comments
 (0)