-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests_execution.py
More file actions
63 lines (42 loc) · 1.61 KB
/
tests_execution.py
File metadata and controls
63 lines (42 loc) · 1.61 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
56
57
58
59
60
61
62
63
import os
from setuptools import find_packages
import nrt_threads_utils
from tests.tests_suite import TestsSuite
PATH = os.path.dirname(__file__)
def __replace_pyproject_packages():
packages = find_packages()
packages.remove('tests')
with open(os.path.join(PATH, 'pyproject.toml')) as f:
file_lines = [line.strip() for line in f.readlines()]
is_replace = False
for i, line in enumerate(file_lines):
if line.startswith('packages'):
if 'tests' in packages:
packages.remove('tests')
file_lines[i] = f"packages={packages}"
is_replace = True
break
if is_replace:
with open(os.path.join(PATH, 'pyproject.toml'), 'w') as f:
f.write('\n'.join(file_lines))
def __replace_pyproject_version():
with open(os.path.join(PATH, 'pyproject.toml')) as f:
file_lines = [line.strip() for line in f.readlines()]
is_replace = False
for i, line in enumerate(file_lines):
if line.startswith('version'):
version = line.split('=')[1]
if version != nrt_threads_utils.__version__:
is_replace = True
file_lines[i] = f"version='{nrt_threads_utils.__version__}'"
break
if is_replace:
with open(os.path.join(PATH, 'pyproject.toml'), 'w') as f:
f.write('\n'.join(file_lines))
##################################################################
__replace_pyproject_version()
__replace_pyproject_packages()
test_suite = TestsSuite(True)
test_suite.run_tests()
test_suite.create_report()
test_suite.erase_data()