Skip to content

Commit 0a0cd17

Browse files
author
Steven Silvester
committed
make more outputs quiet in CI and tests
1 parent 778d05e commit 0a0cd17

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

jupyter_releaser/lib.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,9 @@ def publish_assets(dist_dir, npm_token, npm_cmd, twine_cmd, dry_run):
391391
elif suffix == ".tgz":
392392
# Ignore already published versions
393393
try:
394-
util.run(f"{npm_cmd} {name}", cwd=dist_dir, quiet=True)
394+
util.run(
395+
f"{npm_cmd} {name}", cwd=dist_dir, quiet=True, quiet_error=True
396+
)
395397
except CalledProcessError as e:
396398
stderr = e.stderr
397399
if (

jupyter_releaser/npm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,17 @@ def tag_workspace_packages():
166166
if "workspaces" not in data:
167167
return
168168

169+
skipped = []
169170
for path in _get_workspace_packages(data):
170171
sub_package_json = path / "package.json"
171172
sub_data = json.loads(sub_package_json.read_text(encoding="utf-8"))
172173
tag_name = f"{sub_data['name']}@{sub_data['version']}"
173174
if tag_name in tags:
174-
util.log(f"Skipping existing tag {tag_name}")
175+
skipped.append(tag_name)
175176
else:
176177
util.run(f"git tag {tag_name}")
178+
if skipped:
179+
print(f"\nSkipped existing tags:\n{skipped}\n")
177180

178181

179182
def _get_workspace_packages(data):

jupyter_releaser/python.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ def build_dist(dist_dir):
2222
# Clean the dist folder of existing npm tarballs
2323
os.makedirs(dist_dir, exist_ok=True)
2424
dest = Path(dist_dir)
25-
for pkg in glob(f"{dist_dir}/*.gz") + glob(f"{dist_dir}/*.whl"):
25+
for pkg in glob(f"{dest}/*.gz") + glob(f"{dest}/*.whl"):
2626
os.remove(pkg)
2727

2828
if PYPROJECT.exists():
29-
util.run(f"python -m build --outdir {dist_dir} .")
29+
util.run(f"python -m build --outdir {dest} .", quiet=True)
3030
elif SETUP_PY.exists():
31-
util.run(f"python setup.py sdist --dist-dir {dist_dir}")
32-
util.run(f"python setup.py bdist_wheel --dist-dir {dist_dir}")
31+
util.run(f"python setup.py sdist --dist-dir {dest}", quiet=True)
32+
util.run(f"python setup.py bdist_wheel --dist-dir {dest}", quiet=True)
3333

3434

3535
def check_dist(dist_file, test_cmd=""):

jupyter_releaser/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def workspace_package(npm_package):
9393
new_dir = prev_dir / "packages" / name
9494
os.makedirs(new_dir)
9595
os.chdir(new_dir)
96-
run("npm init -y")
96+
run("npm init -y", quiet=True)
9797
index = new_dir / "index.js"
9898
index.write_text('console.log("hello")', encoding="utf-8")
9999
if name == "foo":
@@ -119,7 +119,7 @@ def py_dist(py_package, runner, mocker, build_mock, git_prep):
119119
changelog_entry = testutil.mock_changelog_entry(py_package, runner, mocker)
120120

121121
# Create the dist files
122-
util.run("python -m build .", cwd=util.CHECKOUT_NAME)
122+
util.run("python -m build .", cwd=util.CHECKOUT_NAME, quiet=True)
123123

124124
# Finalize the release
125125
runner(["tag-release"])

jupyter_releaser/tests/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def create_npm_package(git_repo):
146146
run('git commit -m "initial npm package"')
147147

148148
run("git checkout foo")
149-
run("git pull origin bar")
149+
run("git pull origin bar", quiet=True)
150150
run("git checkout bar")
151151
return git_repo
152152

@@ -187,7 +187,7 @@ def create_python_package(git_repo):
187187
run('git commit -m "initial python package"')
188188

189189
run("git checkout foo")
190-
run("git pull origin bar")
190+
run("git pull origin bar", quiet=True)
191191
run("git checkout bar")
192192

193193
return git_repo

jupyter_releaser/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@
4242

4343
def run(cmd, **kwargs):
4444
"""Run a command as a subprocess and get the output as a string"""
45+
quiet_error = kwargs.pop("quiet_error", False)
4546
if sys.platform.startswith("win"):
4647
# Async subprocesses do not work well on Windows, use standard
4748
# subprocess methods
4849
return _run_win(cmd, **kwargs)
4950

5051
quiet = kwargs.get("quiet")
51-
quiet_error = kwargs.get("quiet_error")
5252
kwargs.setdefault("echo", True)
5353
kwargs.setdefault("check", True)
5454

0 commit comments

Comments
 (0)