How to use the pybuilder.core.Project function in pybuilder

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 / unittest / python / plugins / python / cram_plugin_tests.py View on Github external
def test_report(self):
        project = Project('.')
        project.set_property('dir_reports', '/any/dir')
        expected = nc('./any/dir/cram.err')
        received = _report_file(project)
        self.assertEquals(expected, received)
github pybuilder / pybuilder / src / unittest / python / plugins / python / cram_plugin_tests.py View on Github external
def test_running_plugin_cram_from_target(self,
                                             execute_mock,
                                             read_file_mock,
                                             os_mock,
                                             report_mock,
                                             find_files_mock,
                                             command_mock
                                             ):
        project = Project('.')
        project.set_property('cram_run_test_from_target', True)
        project.set_property('dir_dist', 'python')
        project.set_property('dir_dist_scripts', 'scripts')
        project.set_property('verbose', False)
        logger = Mock()

        command_mock.return_value = ['cram']
        find_files_mock.return_value = ['test1.cram', 'test2.cram']
        report_mock.return_value = 'report_file'
        os_mock.copy.return_value = {}
        read_file_mock.return_value = ['test failes for file', '# results']
        execute_mock.return_value = 0

        run_cram_tests(project, logger)
        execute_mock.assert_called_once_with(
            ['cram', 'test1.cram', 'test2.cram'], 'report_file',
github pybuilder / pybuilder / src / unittest / python / plugins / python / pdoc_plugin_tests.py View on Github external
def setUp(self):
        self.logger = Mock()
        self.project = Project(".")
        self.project.set_property("dir_target", "dir_target_value")
        self.project.set_property("dir_source_main_python", "dir_source_main_python_value")
        self.project.set_property("dir_reports", "dir_reports_value")
github pybuilder / pybuilder / src / unittest / python / external_command_tests.py View on Github external
def setUp(self):
        self.project = Project('/base/dir')
        self.command = ExternalCommandBuilder('command-name', self.project)
github pybuilder / pybuilder / src / unittest / python / plugins / python / cram_plugin_tests.py View on Github external
def test_running_plugin_fails_with_verbose(self,
                                               execute_mock,
                                               read_file_mock,
                                               os_mock,
                                               report_mock,
                                               find_files_mock,
                                               command_mock
                                               ):
        project = Project('.')
        project.set_property('verbose', True)
        project.set_property('dir_source_main_python', 'python')
        project.set_property('dir_source_main_scripts', 'scripts')
        logger = Mock()

        command_mock.return_value = ['cram']
        find_files_mock.return_value = ['test1.cram', 'test2.cram']
        report_mock.return_value = 'report_file'
        os_mock.copy.return_value = {}
        read_file_mock.return_value = ['test failes for file', '# results']
        execute_mock.return_value = 1

        self.assertRaises(
            BuildFailedException, run_cram_tests, project, logger)
        execute_mock.assert_called_once_with(
            ['cram', 'test1.cram', 'test2.cram'], 'report_file',
github pybuilder / pybuilder / src / unittest / python / plugins / python / distutils_plugin_tests.py View on Github external
def create_project():
    project = Project("/")
    project.build_depends_on("testingframework")
    project.depends_on("sometool")
    project.depends_on(
        "pyassert", url="https://github.com/downloads/halimath/pyassert/pyassert-0.2.2.tar.gz")
    project.name = "Spam and Eggs"
    project.version = "1.2.3"
    project.summary = "This is a simple integration-test for distutils plugin."
    project.description = "As you might have guessed we have nothing to say here."
    project.authors = [
        Author("Udo Juettner", "udo.juettner@gmail.com"), Author("Michael Gruber", "aelgru@gmail.com")]
    project.license = "WTFPL"
    project.url = "http://github.com/pybuilder/pybuilder"
    project.explicit_namespaces = ["foo.bar", "quick.brown.fox"]

    def return_dummy_list():
        return ["spam", "eggs"]
github pybuilder / pybuilder / src / unittest / python / core_tests.py View on Github external
def setUp(self):
        self.project = Project(basedir="/imaginary", name="Unittest")
github pybuilder / pybuilder / src / unittest / python / plugins / python / pycharm_plugin_tests.py View on Github external
def test_should_write_pycharm_file(self, os, mock_open):
        project = Project('basedir', name='pybuilder')
        project.set_property('dir_source_main_python', 'src/main/python')
        project.set_property('dir_source_unittest_python', 'src/unittest/python')
        project.set_property('dir_source_integrationtest_python', 'src/integrationtest/python')
        project.set_property('dir_target', 'build')
        mock_open.return_value = MagicMock(spec=TYPE_FILE)
        os.path.join.side_effect = lambda first, second: first + sep + second

        pycharm_generate(project, Mock())

        mock_open.assert_called_with(nc('basedir/.idea/pybuilder.iml'), 'w')
        metadata_file = mock_open.return_value.__enter__.return_value
        metadata_file.write.assert_called_with("""
github pybuilder / pybuilder / src / unittest / python / plugins / python / cram_plugin_tests.py View on Github external
def test_command_respects_verbose(self):
        project = Project('.')
        project.set_property('verbose', True)
        expected = ['cram', '-E', '--verbose']
        received = _cram_command_for(project)
        self.assertEquals(expected, received)