import bolt import bolt_flask import behave_restful.bolt_behave_restful as bbr bolt.register_module_tasks(bolt_flask) bolt.register_module_tasks(bbr) # Bolt has a provided task sleep that is automatically registered config = { 'start-flask': { 'startup-script': 'run_api.py' }, 'wait-for-server-running': { 'url': 'http://127.0.0.1:5000/ping' }, 'behave-restful': { 'directory': 'features', # path to features folder # 'options': { # 'i': 'posts_binary_data.feature' # test just one feature # } # 'definition': 'yourdefinition', # if you are using definitions for different environments } } # Register a task to invoke all that here: bolt.register_task( 'test-features', ['start-flask', 'wait-for-server-running', 'behave-restful'])
shutil.rmtree(_dist_dir, ignore_errors=True) #Copy ressources directory copy(_res_dir, _dist_dir, '*.*') #Copy single files shutil.copy(os.path.join(PROJECT_ROOT, 'addon.xml'), _dist_dir) shutil.copy(os.path.join(PROJECT_ROOT, 'changelog.txt'), _dist_dir) shutil.copy(os.path.join(PROJECT_ROOT, 'default.py'), _dist_dir) shutil.copy(os.path.join(PROJECT_ROOT, 'service.py'), _dist_dir) shutil.copy(os.path.join(PROJECT_ROOT, 'LICENSE'), _dist_dir) #Distribute to Kodi _kodi_dir = '/Users/matt/Library/Application Support/Kodi/addons/plugin.video.osmosis/' shutil.rmtree(_kodi_dir, ignore_errors=True) shutil.copytree(_dist_dir, _kodi_dir) os.system("open /Applications/Kodi.app") bolt.register_task('dist', dist_task) def copy(src, dest, ext): for file_path in glob.glob(os.path.join(src, '**', ext), recursive=True): new_path = os.path.join(dest, os.path.relpath(file_path)) if os.path.isdir(file_path) != True: os.makedirs(os.path.dirname(new_path), exist_ok=True) shutil.copy(file_path, new_path) config = {'pip': {'command': 'install', 'options': {'r': 'requirements.txt'}}}
import time import bolt import bolt_flask import behave_restful.bolt_behave_restful as br bolt.register_module_tasks(bolt_flask) bolt.register_module_tasks(br) PROJECT_ROOT = path.abspath(path.dirname(__file__)) SRC_DIR = path.join(PROJECT_ROOT, 'battleship') TESTS_DIR = path.join(PROJECT_ROOT, 'tests') FEATURES_DIR = path.join(PROJECT_ROOT, 'features') bolt.register_task('ut', ['delete-pyc', 'delete-pyc.from-tests', 'nose']) bolt.register_task('ct', ['conttest']) bolt.register_task('ft', ['delete-pyc', 'start-flask', 'wait', 'behave-restful']) def wait(config, **_ignored): seconds = config.get('seconds', 0) time.sleep(seconds) bolt.register_task('wait', wait) config = { 'delete-pyc': { 'sourcedir': SRC_DIR,
'options': { 'with-xunit': True, 'xunit-file': os.path.join(_output_dir, 'unit_tests_log.xml'), 'with-coverage': True, 'cover-erase': True, 'cover-package': 'bolt', 'cover-html': True, 'cover-html-dir': _coverage_dir, } } }, 'setup': { 'command': 'bdist_wheel', 'egg-info': { 'command': 'egg_info' } }, } # Development tasks bolt.register_task('clear-pyc', ['delete-pyc', 'delete-pyc.test-pyc']) bolt.register_task('ut', ['clear-pyc', 'nose']) bolt.register_task('ct', ['conttest']) bolt.register_task('pack', ['setup', 'setup.egg-info']) # CI/CD tasks bolt.register_task('run-unit-tests', ['mkdir', 'nose.ci']) # Default task (not final). bolt.register_task('default', ['pip', 'ut'])
import bolt bolt.register_task('clear-pyc', ['delete-pyc.src', 'delete-pyc.tests']) bolt.register_task('ut', ['clear-pyc', 'set-vars.unit-test', 'shell.pytest']) bolt.register_task('ct', ['clear-pyc', 'set-vars.unit-test', 'shell.pytest.continuous']) bolt.register_task('cov', ['clear-pyc', 'set-vars.unit-test', 'shell.pytest.with-coverage']) bolt.register_task('default', ['ct']) config = { 'delete-pyc': { 'src': { 'sourcedir': './emails', 'recursive': True }, 'tests': { 'sourcedir': './tests/unit', 'recursive': True } }, 'set-vars': { 'unit-test': { 'vars': { 'PYTHONPATH': '.' }, }, }, 'shell': { 'pytest': { 'command': 'pytest', 'with-coverage': {
# Describe the behaviour of your code before you write it # uncle Bob Martin import os import bolt bolt.register_task('ut', ['clear-pyc', 'nose']) bolt.register_task('ct', ['conttest']) bolt.register_task('clear-pyc', ['delete-pyc', 'delete-pyc.from-tests']) PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) _src_dir = os.path.join(PROJECT_ROOT, 'src') _tests_dir = os.path.join(PROJECT_ROOT, 'tests') config = { 'conttest': { 'task': 'ut', 'directory': PROJECT_ROOT }, 'delete-pyc': { 'sourcedir': _src_dir, 'recursive': True, 'from-tests': { 'sourcedir': _tests_dir, } }, 'nose': { 'directory': _tests_dir, } }
import os import bolt bolt.register_task('clear-pyc', ['delete-pyc.src', 'delete-pyc.tests']) bolt.register_task('ct', ['clear-pyc', 'conttest']) bolt.register_task('cov', ['clear-pyc', 'nose.with-coverage']) bolt.register_task('ut', ['clear-pyc', 'nose']) _PROJECT_ROOT = os.getcwd() _SOURCE_CODE_DIR = os.path.join(_PROJECT_ROOT, 'src') _UNIT_TEST_DIR = os.path.join(_PROJECT_ROOT, 'tests', 'unit') config = { 'delete-pyc': { 'src': { 'sourcedir': _SOURCE_CODE_DIR, 'recursive': True }, 'tests': { 'sourcedir': _UNIT_TEST_DIR, 'recursive': True } }, 'nose': { 'directory': _UNIT_TEST_DIR, 'with-coverage': { 'options': { 'with-coverage': True, 'cover-erase': True, 'cover-package': 'src',
import os.path import bolt import behave_restful.bolt_behave_restful as bolt_br bolt.register_module_tasks(bolt_br) # DEVELOPMENT TASKS bolt.register_task('default', [ 'pip', 'run-unit-tests', 'run-feature-tests' ]) bolt.register_task('ut', [ 'run-unit-tests' ]) bolt.register_task('ct', [ 'conttest' ]) bolt.register_task('ft', [ 'run-feature-tests' ]) # CI/CD TASKS bolt.register_task('execute-unit-tests', [ 'clear-pyc-testing', 'mkdir', 'mkdir.tests', 'mkdir.tests.coverage', 'nose.ci', ])
'cover-html': True, 'cover-html-dir': _coverage_dir, 'cover-branches': True, } } }, 'setup': { 'command': 'bdist_wheel', 'egg-info': { 'command': 'egg_info' } }, 'coverage': { 'task': 'nose', 'include': ['bolt'], 'output': os.path.join(_output_dir, 'ut_coverage') } } # Development tasks bolt.register_task('clear-pyc', ['delete-pyc', 'delete-pyc.test-pyc']) bolt.register_task('ut', ['clear-pyc', 'nose']) bolt.register_task('ct', ['conttest']) bolt.register_task('pack', ['setup', 'setup.egg-info']) # CI/CD tasks bolt.register_task('run-unit-tests', ['mkdir', 'nose.ci']) # Default task (not final). bolt.register_task('default', ['pip', 'ut'])