Skip to content

Commit 2774410

Browse files
committed
test: simplify skipper, and make it suppressable
1 parent 8b9cecc commit 2774410

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

igor.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
PYPY = platform.python_implementation() == "PyPy"
3939

4040

41-
# $set_env.py: COVERAGE_IGOR_VERBOSE - More output from igor.py
42-
VERBOSITY = int(os.getenv("COVERAGE_IGOR_VERBOSE", "0"))
41+
# $set_env.py: COVERAGE_IGOR_VERBOSE - How much chatter from igor.py (default 1)
42+
VERBOSITY = int(os.getenv("COVERAGE_IGOR_VERBOSE", "1"))
4343

4444
# Functions named do_* are executable from the command line: do_blah is run
4545
# by "python igor.py blah".
@@ -87,16 +87,16 @@ def do_remove_extension(*args):
8787

8888
for root, pattern in itertools.product(roots, so_patterns):
8989
pattern = os.path.join(root, pattern)
90-
if VERBOSITY:
90+
if VERBOSITY > 1:
9191
print(f"Searching for {pattern} from {os.getcwd()}")
9292
for filename in glob.glob(pattern):
9393
if os.path.exists(filename):
94-
if VERBOSITY:
94+
if VERBOSITY > 1:
9595
print(f"Removing {os.path.abspath(filename)}")
9696
try:
9797
os.remove(filename)
9898
except OSError as exc:
99-
if VERBOSITY:
99+
if VERBOSITY > 1:
100100
print(f"Couldn't remove {os.path.abspath(filename)}: {exc}")
101101

102102

@@ -140,13 +140,9 @@ def should_skip(core):
140140
skipper = f"No C core for {platform.python_implementation()}"
141141

142142
if skipper:
143-
msg = "Skipping tests " + label_for_core(core)
144-
if len(skipper) > 1:
145-
msg += ": " + skipper
143+
return f"Skipping tests {label_for_core(core)}: {skipper}"
146144
else:
147-
msg = ""
148-
149-
return msg
145+
return ""
150146

151147

152148
def make_env_id(core):
@@ -253,7 +249,8 @@ def do_test_with_core(core, *runner_args):
253249
# If we should skip these tests, skip them.
254250
skip_msg = should_skip(core)
255251
if skip_msg:
256-
print(skip_msg)
252+
if VERBOSITY > 0:
253+
print(skip_msg)
257254
return None
258255

259256
os.environ["COVERAGE_CORE"] = core

0 commit comments

Comments
 (0)