def setUp(self) -> None:
     self.tmpDir = tempfile.mkdtemp()
     self.project = Project(basedir=self.tmpDir)
     self.project.set_property(ENVIRONMENT,"unit-test")
     core_plugin.init(self.project)
     init_plugin(self.project)
     init_python_directories(self.project)
Example #2
0
    def test_should_set_list_modules_function_with_project_modules(
            self, _, source_listdir):
        source_listdir.return_value = ["foo.py", "bar.py", "some-package"]

        init_python_directories(self.project)

        self.assertEquals(['foo', 'bar'],
                          self.greedy(self.project.list_modules()))
Example #3
0
    def test_should_set_list_modules_function_with_project_modules(self, _, source_listdir):
        source_listdir.return_value = ["foo.py", "bar.py", "some-package"]

        init_python_directories(self.project)

        self.assertEquals(
            ['foo', 'bar'],
            self.greedy(self.project.list_modules())
        )
Example #4
0
    def test_should_not_cut_off_packages_when_path_ends_with_trailing_slash(
            self, _, walk):
        walk.return_value = [(join(".", "src", "main", "python",
                                   "pybuilder"), ['pluginhelper', 'plugins'], [
                                       'execution.py', 'terminal.py',
                                       'execution.pyc', 'scaffolding.py'
                                   ])]
        self.project.set_property("dir_source_main_python", "src/main/python/")

        init_python_directories(self.project)

        self.assertEquals(['pybuilder.pluginhelper', 'pybuilder.plugins'],
                          self.greedy(self.project.list_packages()))
    def test_should_not_cut_off_packages_when_path_ends_with_trailing_slash(self, _, walk):
        walk.return_value = [("./src/main/python/pybuilder",
                              ['pluginhelper', 'plugins'],
                              ['execution.py', 'terminal.py', 'execution.pyc', 'scaffolding.py']
                              )]
        self.project.set_property("dir_source_main_python",
                                  "src/main/python/")

        init_python_directories(self.project)

        self.assertEquals(
            ['pybuilder.pluginhelper',
             'pybuilder.plugins'],
            self.greedy(self.project.list_packages())
        )
    def test_should_set_list_packages_function_with_project_packages(self, _, walk):
        walk.return_value = [("./src/main/python/pybuilder",
                              ['pluginhelper', 'plugins'],
                              ['execution.py', 'terminal.py', 'execution.pyc', 'scaffolding.py']
                              )]
        self.project.set_property("dir_source_main_python",
                                  "src/main/python")

        init_python_directories(self.project)

        self.assertEquals(
            ['pybuilder.pluginhelper',
             'pybuilder.plugins'],
            self.greedy(self.project.list_packages())
        )
    def test_should_set_list_packages_function_with_project_packages(self, _, walk):
        walk.return_value = [(join(".", "src", "main", "python", "pybuilder"),
                              ['pluginhelper', 'plugins'],
                              ['execution.py', 'terminal.py', 'execution.pyc', 'scaffolding.py']
                              )]
        self.project.set_property("dir_source_main_python",
                                  "src/main/python")

        init_python_directories(self.project)

        self.assertEquals(
            ['pybuilder.pluginhelper',
             'pybuilder.plugins'],
            self.greedy(self.project.list_packages())
        )
Example #8
0
    def test_should_not_cut_off_packages_when_path_ends_with_trailing_slash(
            self, _, walk):
        self.project.set_property("dir_source_main_python", "src/main/python/")

        init_python_directories(self.project)
        src_path = self.project.expand_path("$dir_source_main_python")

        walk.return_value = [(join(src_path,
                                   "pybuilder"), ["pluginhelper", "plugins"],
                              ("__init__.py", "foo.py", "foo.txt")),
                             (join(src_path, "pybuilder",
                                   "pluginhelper"), (), "__init__.py"),
                             (join(src_path, "pybuilder",
                                   "plugins"), (), "__init__.py")]

        self.assertEqual(
            ["pybuilder", "pybuilder.pluginhelper", "pybuilder.plugins"],
            self.greedy(self.project.list_packages()))
Example #9
0
 def test_should_set_dist_property(self):
     init_python_directories(self.project)
     self.assertEquals("$dir_target/dist/.-1.0-SNAPSHOT",
                       self.project.get_property(DISTRIBUTION_PROPERTY, "caboom"))
Example #10
0
 def test_should_set_dist_scripts_property(self):
     init_python_directories(self.project)
     self.assertEquals(
         None, self.project.get_property(SCRIPTS_TARGET_PROPERTY, "caboom"))
Example #11
0
 def test_should_set_scripts_sources_property(self):
     init_python_directories(self.project)
     self.assertEquals(
         "src/main/scripts", self.project.get_property(SCRIPTS_SOURCES_PROPERTY, "caboom"))
Example #12
0
 def test_should_set_python_sources_property(self):
     init_python_directories(self.project)
     self.assertEquals(
         "src/main/python", self.project.get_property(PYTHON_SOURCES_PROPERTY, "caboom"))
Example #13
0
 def test_should_set_dist_property(self):
     init_python_directories(self.project)
     self.assertEquals(
         "$dir_target/dist/.-1.0-SNAPSHOT",
         self.project.get_property(DISTRIBUTION_PROPERTY, "caboom"))
Example #14
0
 def test_should_set_dist_scripts_property(self):
     init_python_directories(self.project)
     self.assertEquals(
         None, self.project.get_property(SCRIPTS_TARGET_PROPERTY, "caboom"))
Example #15
0
 def test_should_set_scripts_sources_property(self):
     init_python_directories(self.project)
     self.assertEquals(
         "src/main/scripts",
         self.project.get_property(SCRIPTS_SOURCES_PROPERTY, "caboom"))
Example #16
0
 def test_should_set_python_sources_property(self):
     init_python_directories(self.project)
     self.assertEquals(
         "src/main/python",
         self.project.get_property(PYTHON_SOURCES_PROPERTY, "caboom"))