Remove debug print statements in unit-tests (#49280)

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
Massimiliano Culpo 2025-03-04 18:29:45 +01:00 committed by GitHub
parent 11051ce5c7
commit bc04d963e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 2 additions and 18 deletions

View File

@ -569,7 +569,6 @@ def test_FetchCacheError_only_accepts_lists_of_errors():
def test_FetchCacheError_pretty_printing_multiple(): def test_FetchCacheError_pretty_printing_multiple():
e = bindist.FetchCacheError([RuntimeError("Oops!"), TypeError("Trouble!")]) e = bindist.FetchCacheError([RuntimeError("Oops!"), TypeError("Trouble!")])
str_e = str(e) str_e = str(e)
print("'" + str_e + "'")
assert "Multiple errors" in str_e assert "Multiple errors" in str_e
assert "Error 1: RuntimeError: Oops!" in str_e assert "Error 1: RuntimeError: Oops!" in str_e
assert "Error 2: TypeError: Trouble!" in str_e assert "Error 2: TypeError: Trouble!" in str_e

View File

@ -210,7 +210,6 @@ def check_args_contents(cc, args, must_contain, must_not_contain):
""" """
with set_env(SPACK_TEST_COMMAND="dump-args"): with set_env(SPACK_TEST_COMMAND="dump-args"):
cc_modified_args = cc(*args, output=str).strip().split("\n") cc_modified_args = cc(*args, output=str).strip().split("\n")
print(cc_modified_args)
for a in must_contain: for a in must_contain:
assert a in cc_modified_args assert a in cc_modified_args
for a in must_not_contain: for a in must_not_contain:

View File

@ -347,7 +347,6 @@ def test_get_spec_filter_list(mutable_mock_env_path, mutable_mock_repo):
for key, val in expectations.items(): for key, val in expectations.items():
affected_specs = ci.get_spec_filter_list(e1, touched, dependent_traverse_depth=key) affected_specs = ci.get_spec_filter_list(e1, touched, dependent_traverse_depth=key)
affected_pkg_names = set([s.name for s in affected_specs]) affected_pkg_names = set([s.name for s in affected_specs])
print(f"{key}: {affected_pkg_names}")
assert affected_pkg_names == val assert affected_pkg_names == val

View File

@ -214,9 +214,7 @@ def verify_mirror_contents():
if in_env_pkg in p: if in_env_pkg in p:
found_pkg = True found_pkg = True
if not found_pkg: assert found_pkg, f"Expected to find {in_env_pkg} in {dest_mirror_dir}"
print("Expected to find {0} in {1}".format(in_env_pkg, dest_mirror_dir))
assert False
# Install a package and put it in the buildcache # Install a package and put it in the buildcache
s = spack.concretize.concretize_one(out_env_pkg) s = spack.concretize.concretize_one(out_env_pkg)

View File

@ -898,7 +898,6 @@ def test_cdash_configure_warning(tmpdir, mock_fetch, install_mockery, capfd):
specfile = "./spec.json" specfile = "./spec.json"
with open(specfile, "w", encoding="utf-8") as f: with open(specfile, "w", encoding="utf-8") as f:
f.write(spec.to_json()) f.write(spec.to_json())
print(spec.to_json())
install("--log-file=cdash_reports", "--log-format=cdash", specfile) install("--log-file=cdash_reports", "--log-format=cdash", specfile)
# Verify Configure.xml exists with expected contents. # Verify Configure.xml exists with expected contents.
report_dir = tmpdir.join("cdash_reports") report_dir = tmpdir.join("cdash_reports")

View File

@ -50,7 +50,7 @@ def test_list_long(capsys):
def test_list_long_with_pytest_arg(capsys): def test_list_long_with_pytest_arg(capsys):
with capsys.disabled(): with capsys.disabled():
output = spack_test("--list-long", cmd_test_py) output = spack_test("--list-long", cmd_test_py)
print(output)
assert "unit_test.py::\n" in output assert "unit_test.py::\n" in output
assert "test_list" in output assert "test_list" in output
assert "test_list_with_pytest_arg" in output assert "test_list_with_pytest_arg" in output

View File

@ -49,7 +49,6 @@ def test_single_file_verify_cmd(tmpdir):
sjson.dump({filepath: data}, f) sjson.dump({filepath: data}, f)
results = verify("manifest", "-f", filepath, fail_on_error=False) results = verify("manifest", "-f", filepath, fail_on_error=False)
print(results)
assert not results assert not results
os.utime(filepath, (0, 0)) os.utime(filepath, (0, 0))

View File

@ -2018,7 +2018,6 @@ def test_git_ref_version_is_equivalent_to_specified_version(self, git_ref):
s = Spec("develop-branch-version@git.%s=develop" % git_ref) s = Spec("develop-branch-version@git.%s=develop" % git_ref)
c = spack.concretize.concretize_one(s) c = spack.concretize.concretize_one(s)
assert git_ref in str(c) assert git_ref in str(c)
print(str(c))
assert s.satisfies("@develop") assert s.satisfies("@develop")
assert s.satisfies("@0.1:") assert s.satisfies("@0.1:")

View File

@ -2148,7 +2148,6 @@ def _c_compiler_always_exists():
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def mock_test_cache(tmp_path_factory): def mock_test_cache(tmp_path_factory):
cache_dir = tmp_path_factory.mktemp("cache") cache_dir = tmp_path_factory.mktemp("cache")
print(cache_dir)
return spack.util.file_cache.FileCache(cache_dir) return spack.util.file_cache.FileCache(cache_dir)

View File

@ -977,7 +977,6 @@ class MyBuildException(Exception):
def _install_fail_my_build_exception(installer, task, install_status, **kwargs): def _install_fail_my_build_exception(installer, task, install_status, **kwargs):
print(task, task.pkg.name)
if task.pkg.name == "pkg-a": if task.pkg.name == "pkg-a":
raise MyBuildException("mock internal package build error for pkg-a") raise MyBuildException("mock internal package build error for pkg-a")
else: else:

View File

@ -27,9 +27,7 @@ def check_spliced_spec_prefixes(spliced_spec):
text_file_path = os.path.join(node.prefix, node.name) text_file_path = os.path.join(node.prefix, node.name)
with open(text_file_path, "r", encoding="utf-8") as f: with open(text_file_path, "r", encoding="utf-8") as f:
text = f.read() text = f.read()
print(text)
for modded_spec in node.traverse(root=True, deptype=dt.ALL & ~dt.BUILD): for modded_spec in node.traverse(root=True, deptype=dt.ALL & ~dt.BUILD):
print(modded_spec)
assert modded_spec.prefix in text assert modded_spec.prefix in text

View File

@ -149,11 +149,8 @@ def test_reverse_environment_modifications(working_env):
os.environ.clear() os.environ.clear()
os.environ.update(start_env) os.environ.update(start_env)
print(os.environ)
to_reverse.apply_modifications() to_reverse.apply_modifications()
print(os.environ)
reversal.apply_modifications() reversal.apply_modifications()
print(os.environ)
start_env.pop("UNSET") start_env.pop("UNSET")
assert os.environ == start_env assert os.environ == start_env

View File

@ -257,7 +257,6 @@ def test_core_lib_files():
names.append(os.path.join(test_dir, n)) names.append(os.path.join(test_dir, n))
for filename in names: for filename in names:
print("Testing %s" % filename)
source = read_pyfile(filename) source = read_pyfile(filename)
check_ast_roundtrip(source) check_ast_roundtrip(source)