Skip to content

Commit

Permalink
Move test warnings to log after test run
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasserra committed Jun 22, 2023
1 parent e26158c commit 902353e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/test.py
Expand Up @@ -37,11 +37,12 @@ def setup():

setup()
default_tags = []
warnings = []
for extra_lib in ('pygments', 'wavedrom'):
try:
mod = importlib.import_module(extra_lib)
except ImportError:
log.warning("skipping %s tests ('%s' module not found)" % (extra_lib, extra_lib))
warnings.append("skipping %s tests ('%s' module not found)" % (extra_lib, extra_lib))
default_tags.append("-%s" % extra_lib)
else:
if extra_lib == 'pygments':
Expand All @@ -50,9 +51,13 @@ def setup():
tag = "pygments<2.14"
else:
tag = "pygments>=2.14"
log.warning("skipping %s tests (pygments %s found)" % (tag, mod.__version__))
warnings.append("skipping %s tests (pygments %s found)" % (tag, mod.__version__))
default_tags.append("-%s" % tag)

retval = testlib.harness(testdir_from_ns=testdir_from_ns,
default_tags=default_tags)

for warning in warnings:
log.warning(warning)

sys.exit(retval)

0 comments on commit 902353e

Please sign in to comment.