import os, glob
import subprocess
from subprocess import DEVNULL, STDOUT


abspath = os.path.abspath(__file__)
dir_ = os.path.dirname(abspath)

files = glob.glob(dir_ + "/_progress_board_tests/_test_progress_board_*.py")

for file_path in files:
    file_name = str(file_path.rsplit("/", maxsplit=1)[1])

    try:
        print("\033[0;33;40m Testing", file_name, end="...\r")
        subprocess.check_call(["pytest", file_path], stdout=DEVNULL, stderr=STDOUT)
    except subprocess.CalledProcessError:
        print("\033[0;31;40m Error in", file_name)
    else:
        print("\033[0;32;40m", file_name, "is correct")

[((6, 10, 6, 35), 'os.path.abspath', 'os.path.abspath', ({(6, 26, 6, 34): '__file__'}, {}), '(__file__)', False, 'import os, glob\n'), ((7, 7, 7, 31), 'os.path.dirname', 'os.path.dirname', ({(7, 23, 7, 30): 'abspath'}, {}), '(abspath)', False, 'import os, glob\n'), ((9, 8, 9, 76), 'glob.glob', 'glob.glob', ({(9, 18, 9, 75): "dir_ + '/_progress_board_tests/_test_progress_board_*.py'"}, {}), "(dir_ + '/_progress_board_tests/_test_progress_board_*.py')", False, 'import os, glob\n'), ((16, 8, 16, 83), 'subprocess.check_call', 'subprocess.check_call', (), '', False, 'import subprocess\n')]