1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
theorangeone.net-legacy/runtests

41 lines
1.2 KiB
Text
Raw Normal View History

2016-01-10 16:12:58 +00:00
#!/usr/bin/env python3
import os, sys
import subprocess
from colorama import Fore, init
2015-10-19 13:04:49 +01:00
2016-01-10 16:12:58 +00:00
init(autoreset=True)
2015-10-19 13:04:49 +01:00
2016-01-09 22:56:48 +00:00
2016-01-10 16:23:34 +00:00
bin_dir = os.path.abspath(os.path.join(sys.executable, os.path.pardir))
EXIT_CODE = 0
def check_if_exit_code():
if EXIT_CODE != 0:
2016-01-27 18:27:30 +00:00
print("\n{}Tests Failed. {}Please check messages above and then re-run the command.".format(Fore.RED, Fore.YELLOW))
2016-05-16 13:44:06 +01:00
print("{}Exit Code: {}".format(Fore.RED, EXIT_CODE))
exit(1)
2016-01-09 22:56:48 +00:00
2016-05-15 18:01:20 +01:00
print("{}Linting...".format(Fore.YELLOW))
2016-01-10 16:12:58 +00:00
2016-01-10 16:23:34 +00:00
2016-04-09 13:14:58 +01:00
FLAKE8_IGNORE = '--ignore=E128,E501,E401,E402'
2016-01-10 16:12:58 +00:00
try:
2016-05-15 18:01:20 +01:00
subprocess.check_output([os.path.join(bin_dir, 'flake8'), 'theme', FLAKE8_IGNORE])
2016-01-10 16:12:58 +00:00
subprocess.check_output([os.path.join(bin_dir, 'flake8'), 'scripts', FLAKE8_IGNORE])
2016-05-15 18:01:20 +01:00
subprocess.check_output([os.path.join(bin_dir, 'flake8'), 'pelicanconf.py', FLAKE8_IGNORE])
subprocess.check_output([os.path.join(bin_dir, 'flake8'), sys.argv[0], FLAKE8_IGNORE]) # Test this file
2016-01-10 16:12:58 +00:00
except subprocess.CalledProcessError as e:
2016-01-27 18:27:30 +00:00
print(Fore.RED, e.output.decode())
EXIT_CODE = 1
2016-01-10 16:12:58 +00:00
2016-01-27 18:27:30 +00:00
check_if_exit_code()
print("{}All Python tests passed! {}Testing Static Files...".format(Fore.GREEN, Fore.YELLOW))
2016-01-10 16:12:58 +00:00
EXIT_CODE = os.system('npm test')
check_if_exit_code()
2016-01-27 18:27:30 +00:00
print("{}All Tests Passed!".format(Fore.GREEN))