-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.py
110 lines (94 loc) · 3.95 KB
/
build.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
from pybuilder.core import use_plugin, init, Author, task, description, depends
from pybuilder.pluginhelper.external_command import ExternalCommandBuilder
from pybuilder.errors import BuildFailedException
import sys
use_plugin("python.core")
use_plugin("copy_resources")
use_plugin("filter_resources")
use_plugin("python.unittest")
use_plugin("python.integrationtest")
use_plugin("python.install_dependencies")
use_plugin("python.flake8")
use_plugin("python.distutils")
use_plugin("python.pycharm")
use_plugin("exec")
name = "hydra"
url = 'https://github.com/lake-lerna/hydra'
information = "Please visit {url}".format(url=url)
authors = [Author('Sushil Singh', 'sushilks@gmail.com')]
license = 'Apache 2.0'
summary = "A scale test infra using mesos and marathon."
version = '0.1.0'
default_task = ["analyze", "publish"]
@init
def set_properties(project):
# project.build_depends_on('mockito')
project.build_depends_on('pyzmq')
project.build_depends_on('marathon')
project.build_depends_on('netifaces')
# project.build_depends_on('logging')
project.build_depends_on('docopt')
project.build_depends_on('psutil')
project.build_depends_on('pep8-naming')
project.build_depends_on('pika')
project.build_depends_on('websocket-client')
project.build_depends_on('kafka-python')
project.build_depends_on('pykafka')
project.build_depends_on('pyyaml')
if sys.version_info[0] == 3:
project.build_depends_on('protobuf==3.0.0-b2')
else:
project.build_depends_on('protobuf')
project.set_property('copy_resources_target', '$dir_dist')
project.get_property('copy_resources_glob').append('LICENSE')
project.get_property('copy_resources_glob').append('src/main/data/*')
# project.get_property('copy_resources_glob').append('src/main/data/z')
# project.include_file(name, 'LICENSE')
# project.include_file(name, 'config/*.ini')
# project.include_directory('src/main/data', ['*.ini'])
project.set_property('flake8_verbose_output', True)
project.set_property('flake8_break_build', True)
project.set_property('flake8_include_test_sources', True)
project.set_property('flake8_max_line_length', 130)
project.set_property('publish_command', './make_test_exec.sh')
project.set_property('publish_propagate_stderr', True)
project.set_property('publish_propagate_stdout', True)
project.get_property('distutils_commands').append('bdist_wheel')
project.set_property('distutils_classifiers', [
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Software Development :: Testing',
'Topic :: Software Development :: Quality Assurance'])
pass
@task
@description("Runs all unit tests. Runs unit tests based on Python's unittest module.")
@depends('run_unit_tests')
def test(project, logger):
pass
@task
@description("Run a negative test that will fail due to exception.")
def negative_test(project, logger):
print("Running a -ve test")
command = ExternalCommandBuilder('hydra', project)
command.use_argument('negative-test-exception')
result = command.run_on_production_source_files(logger)
if result.exit_code:
raise BuildFailedException("Exit code is set")
return result.exit_code
@task
@description("Run a positive test case.")
def positive_test(project, logger):
print("Running a postive test")
command = ExternalCommandBuilder('hydra', project)
command.use_argument('positive-test')
result = command.run_on_production_source_files(logger)
if result.exit_code:
raise BuildFailedException("Exit code is set")