How to use pybuilder - 10 common examples

To help you get started, we’ve selected a few pybuilder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pybuilder / pybuilder / src / integrationtest / python / should_raise_exception_when_no_default_goal_is_given_tests.py View on Github external
def test(self):
        self.write_build_file("""
from pybuilder.core import task

@task
def spam (): pass
        """)
        reactor = self.prepare_reactor()

        self.assertRaises(PyBuilderException, reactor.build)
github chandulal / airflow-testing / build.py View on Github external
from pybuilder.core import init, use_plugin


@init
def initialize(project):
    project.set_property("run_unit_tests_propagate_stdout", True)
    project.set_property("run_unit_tests_propagate_stderr", True)
    project.set_property('verbose', True)


use_plugin("exec")
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin('python.install_dependencies')
use_plugin('python.integrationtest')

default_task = ['clean']
github pybuilder / pybuilder / src / unittest / python / core_tests.py View on Github external
        @task("any-task-name")
        @description("any-description")
        def task_with_description():
            pass
github pybuilder / pybuilder / src / unittest / python / utils_tests.py View on Github external
def test_should_unwrap_single_list(self):
        self.assertEquals(["spam", "eggs"], as_list(["spam", "eggs"]))
github pybuilder / pybuilder / src / unittest / python / execution_tests.py View on Github external
def test_ensure_that_dependencies_are_resolved_when_simple_dependency_is_found(self):
        one = Mock(name="one", dependencies=[])
        two = Mock(name="two", dependencies=[TaskDependency("one")])

        self.execution_manager.register_task(one, two)
        self.execution_manager.resolve_dependencies()

        self.assertEqual([], self.execution_manager._task_dependencies.get("one"))
        self.assertEqual([TaskDependency(one)], self.execution_manager._task_dependencies.get("two"))
github pybuilder / pybuilder / src / unittest / python / execution_tests.py View on Github external
def test_should_collect_all_tasks_when_there_is_a_transitive_dependency(self):
        one = Mock(name="one", dependencies=[TaskDependency("two")])
        two = Mock(name="two", dependencies=[TaskDependency("three")])
        three = Mock(name="three", dependencies=[])
        self.execution_manager.register_task(one, two, three)
        self.execution_manager.resolve_dependencies()

        self.assertEqual(self.execution_manager.collect_all_transitive_tasks(["one"]), set([one, two, three]))
github pybuilder / pybuilder / src / unittest / python / execution_tests.py View on Github external
def test_is_task_in_current_execution_plan(self):
        one = Mock(name="one", dependencies=[])
        two = Mock(name="two", dependencies=[TaskDependency("one")])
        three = Mock(name="three", dependencies=[TaskDependency("one"), TaskDependency("two")])

        self.execution_manager.register_task(one, two, three)
        self.execution_manager.resolve_dependencies(exclude_all_optional=True)
        self.execution_manager._current_execution_plan = self.execution_manager.build_execution_plan("three")

        self.assertTrue(self.execution_manager.is_task_in_current_execution_plan("three"))
        self.assertTrue(self.execution_manager.is_task_in_current_execution_plan("two"))
        self.assertTrue(self.execution_manager.is_task_in_current_execution_plan("one"))
        self.assertFalse(self.execution_manager.is_task_in_current_execution_plan("four"))
github pybuilder / pybuilder / src / unittest / python / execution_tests.py View on Github external
def test_shortest_execution_plan_reruns_on_demand(self):
        one = Mock(name="one", dependencies=[])
        two = Mock(name="two", dependencies=[TaskDependency("one")])
        three = Mock(name="three", dependencies=[TaskDependency("two")])

        self.execution_manager.register_task(one, two, three)
        self.execution_manager.resolve_dependencies()

        self.execution_manager._tasks_executed.append(one)
        self.execution_manager._tasks_executed.append(two)

        self.assertEqual([two, three], self.execution_manager.build_shortest_execution_plan(("two", "three")))
        self.assertEqual([two, three], self.execution_manager.build_shortest_execution_plan(("three", "two")))
        self.assertEqual([one, two, three], self.execution_manager.build_shortest_execution_plan(("three", "one")))
github pybuilder / pybuilder / src / unittest / python / execution_tests.py View on Github external
def test_verify_error_unresolved_late_dependency(self):
        one = Mock(name="one", dependencies=[])
        two = Mock(name="two", dependencies=[TaskDependency("one")])
        three = Mock(name="three", dependencies=[TaskDependency("one")])

        self.execution_manager.register_task(one, two)
        self.execution_manager.register_task(three)
        self.execution_manager.register_late_task_dependencies(
            {"four": [TaskDependency("three")]})
        self.assertRaises(NoSuchTaskException, self.execution_manager.resolve_dependencies)