Skip to content

Instantly share code, notes, and snippets.

@astrofrog
Created November 6, 2019 18:43
Show Gist options
  • Save astrofrog/a8a6366184bb4b427e748390fae4789a to your computer and use it in GitHub Desktop.
Save astrofrog/a8a6366184bb4b427e748390fae4789a to your computer and use it in GitHub Desktop.
import os
import sys
import glob
import subprocess
import warnings
warnings.simplefilter('ignore')
for subpackage in sorted(glob.glob(os.path.join('astropy', '*'))):
if os.path.isdir(subpackage) and '_' not in subpackage and 'extern' not in subpackage:
output = subprocess.check_output([sys.executable, '-m', 'pytest', subpackage])
nwarn = 0
for line in output.splitlines():
if b'seconds ======' in line:
if b'warnings' in line:
nwarn = int(line.split(b'warnings')[0].split()[-1])
break
print(f'{subpackage}: {nwarn}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment