-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest.py
More file actions
55 lines (43 loc) · 1.75 KB
/
test.py
File metadata and controls
55 lines (43 loc) · 1.75 KB
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
45
46
47
48
49
50
51
52
53
54
55
"""
PepFun 2.0: improved protocols for the analysis of natural and modified peptides
From publication "PepFun 2.0: improved protocols for the analysis of natural and modified peptides"
Author: Rodrigo Ochoa
Year: 2023
"""
########################################################################################
# Authorship
########################################################################################
__author__ = "Rodrigo Ochoa"
__credits__ = ["Rodrigo Ochoa"]
__license__ = "MIT"
__version__ = "2.0"
__email__ = "rodrigo.ochoa@udea.edu.co, rodrigo.ochoa@boehringer-ingelheim.com"
########################################################################################
# Modules
########################################################################################
from unittest import TestLoader, TestResult
from pathlib import Path
##########################################################################
# Function
##########################################################################
def run_tests():
"""
Function to run all the available unittests
"""
test_loader = TestLoader()
test_result = TestResult()
test_directory = str(Path(__file__).resolve().parent / 'tests')
test_suite = test_loader.discover(test_directory, pattern='*_Test.py')
test_suite.run(result=test_result)
if test_result.wasSuccessful():
print("\n################################\nAll of the tests were successful!\n################################")
exit(0)
else:
print("\nFailures:")
for i,fail in enumerate(test_result.failures):
print(f"{i+1}. {fail[0]}\n{fail[1]}")
if test_result.errors:
print("\nErrors:")
exit(-1)
if __name__ == '__main__':
run_tests()