-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_tests.py
44 lines (33 loc) · 1.3 KB
/
run_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from tests.test_SpotifyCredentials import TestSpotifyCredentials
from tests.test_YoutubeToSpotify import TestYoutubeToSpotify
import unittest
from colorama import Fore, Back, Style
def main():
# LOAD TESTS
tc_SpotifyCredentials = unittest.TestLoader(
).loadTestsFromTestCase(TestSpotifyCredentials)
tc_YoutubeToSpotify = unittest.TestLoader(
).loadTestsFromTestCase(TestYoutubeToSpotify)
# BUILD TEST SUITES
credentials = unittest.TestSuite(tc_SpotifyCredentials)
youtube_migrator = unittest.TestSuite(tc_YoutubeToSpotify)
# RUN TESTS
runner = unittest.TextTestRunner(verbosity=2)
print(Style.BRIGHT + Fore.YELLOW +
"\nRUNNING UNIT TESTS..." + Style.RESET_ALL)
print_section_header("TESTING SPOTIFY CREDENTIALS", "YELLOW")
runner.run(credentials)
print_section_header("TESTING YOUTUBE TO SPOTIFY MIGRATOR", "YELLOW")
runner.run(youtube_migrator)
# helpers
def print_section_header(title, color):
divider = "=" * 70
if color == "YELLOW":
color = Fore.YELLOW
elif color == "GREEN":
color = Fore.GREEN
print(Style.DIM + color + f"\n{divider}" + Style.RESET_ALL)
print(Style.BRIGHT + color + title + Style.RESET_ALL)
print(Style.DIM + color + f"{divider}\n" + Style.RESET_ALL)
if __name__ == "__main__":
main()