Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@description("Runs integration tests based on Python's unittest module")
def run_integration_tests(project, logger):
if not project.get_property("integrationtest_parallel"):
reports, total_time = run_integration_tests_sequentially(
project, logger)
else:
reports, total_time = run_integration_tests_in_parallel(
project, logger)
reports_processor = ReportsProcessor(project, logger)
reports_processor.process_reports(reports, total_time)
reports_processor.report_to_ci_server(project)
reports_processor.write_report_and_ensure_all_tests_passed()
@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")
@description("Displays all dependencies the project requires")
def list_dependencies(project):
print("\n".join(
map(lambda d: "{0}".format(" ".join(pip_utils.as_pip_install_target(d))),
project.build_dependencies + project.dependencies)))
@description("Pack a model to model_name_CURRENTDATE.tar.gz")
def archive_model(project):
"""
Use 'pyb -P model_name="" archive_model' to create '_CURRENTDATE.tar.gz'
in 'build' directory. If model_name == 'deeppavlov_docs', then documentation from build/docs will be archived.
"""
import tarfile, datetime
os.chdir('build')
model_name = project.get_property('model_name')
archive_name = model_name + '_' + datetime.date.today().strftime("%y%m%d")
if model_name == 'deeppavlov_docs':
import shutil
shutil.make_archive(archive_name, 'gztar', 'docs', 'deeppavlov')
os.chdir('..')
return
@description("Runs integration tests on the packaged application.")
def run_integration_tests():
pass
@description("Generates eclipse-pydev development files")
def pydev_generate(project, logger):
logger.info("Generating Eclipse/ Pydev project files.")
paths = []
add_property_value_if_present(paths, project, "dir_source_main_python")
add_property_value_if_present(paths, project, "dir_source_main_scripts")
add_property_value_if_present(paths, project, "dir_source_unittest_python")
add_property_value_if_present(paths, project, "dir_source_integrationtest_python")
paths_string = ""
for path in paths:
if os.path.exists(path):
placeholders = {"project_name": project.name,
"path": path}
paths_string += _DOT_PYDEVPROJECT_PATH_LINE_TEMPLATE.substitute(placeholders)
@description("Generates PyCharm development files")
def pycharm_generate(project, logger):
logger.info("Generating PyCharm project files.")
pycharm_directory = project.expand_path(".idea")
project_file_name = "{0}.iml".format(project.name)
_ensure_directory_present(pycharm_directory)
unit_tests = ""
integration_tests = ""
if project.get_property("dir_source_unittest_python"):
unit_tests = """\n """
if project.get_property("dir_source_integrationtest_python"):
integration_tests = """\n """
output_directory = """""" % project.get_property(
@description("Verifies the project and possibly integration tests.")
def verify():
pass
@description("Packages the application.")
def package():
pass
@description("Package a python application.")
def package(project, logger):
init_dist_target(project, logger)
logger.info("Building distribution in {0}".format(project.expand_path("$" + DISTRIBUTION_PROPERTY)))
copy_python_sources(project, logger)
copy_scripts(project, logger)