Пример #1
0
    def valid_search_path(self):
        """ Set the search path in the package manager """

        pkgmanager = PackageManager()

        pkgmanager.user_wralea_path.clear()

        for i in xrange(self.pathList.count()):
            path = self.pathList.item(i).text()
            pkgmanager.add_wralea_path(os.path.abspath(str(path)), pkgmanager.user_wralea_path)

        pkgmanager.write_config()
Пример #2
0
    def test_case_1(self):

        metainfo = {'version': '0.0.1',
                  'license': 'CECILL-C',
                  'authors': 'OpenAlea Consortium',
                  'institutes': 'INRIA/CIRAD',
                  'description': 'Base library.',
                  'url': 'http://openalea.gforge.inria.fr',
                  'icon': ''}

        path = os.path.join(os.path.curdir, "tstpkg")
        mypackage = UserPackage("DummyPkg", metainfo, path)


        factory = mypackage.create_user_node("TestFact",
                                             "category test",
                                             "this is a test",
                                             gen_port_list(3),
                                             gen_port_list(2))
        assert path in factory.search_path
        assert len(factory.inputs)==3
        assert len(factory.outputs)==2

        assert os.path.exists("tstpkg/TestFact.py")
        execfile("tstpkg/TestFact.py")

        mypackage.write()
        assert os.path.exists("tstpkg/__wralea__.py")
        assert os.path.exists("tstpkg/__init__.py")
        execfile("tstpkg/__wralea__.py")

        # Test_clone_package
        path = os.path.join(os.path.curdir, "clonepkg")
        pkg2 = UserPackage("ClonePkg", metainfo, path)
        print pkg2.wralea_path


        # todo this is not working !!
        from openalea.core.pkgmanager import PackageManager
        pm = PackageManager()
        pm.add_wralea_path(path, pm.temporary_wralea_paths)
        pm.init()
        pkg2.clone_from_package(mypackage)
        pkg2.write()

        assert len(pkg2) == 1
        assert len(pkg2["TestFact"].inputs) == 3
        assert id(pkg2["TestFact"]) != id(mypackage["TestFact"])
        assert os.path.exists(path)
        assert os.path.exists(os.path.join(path, '__wralea__.py'))
        assert os.path.exists(os.path.join(path, '__init__.py'))
        assert os.path.exists(os.path.join(path, 'TestFact.py'))
Пример #3
0
    def valid_search_path(self):
        """ Set the search path in the package manager """

        pkgmanager = PackageManager()

        pkgmanager.user_wralea_path.clear()

        for i in xrange(self.pathList.count()):
            path = self.pathList.item(i).text()
            pkgmanager.add_wralea_path(os.path.abspath(str(path)),
                                       pkgmanager.user_wralea_path)

        pkgmanager.write_config()
Пример #4
0
    def test_case_1(self):

        metainfo = {
            'version': '0.0.1',
            'license': 'CECILL-C',
            'authors': 'OpenAlea Consortium',
            'institutes': 'INRIA/CIRAD',
            'description': 'Base library.',
            'url': 'http://openalea.gforge.inria.fr',
            'icon': ''
        }

        path = os.path.join(os.path.curdir, "tstpkg")
        mypackage = UserPackage("DummyPkg", metainfo, path)

        factory = mypackage.create_user_node("TestFact",
                                             "category test", "this is a test",
                                             gen_port_list(3),
                                             gen_port_list(2))
        assert path in factory.search_path
        assert len(factory.inputs) == 3
        assert len(factory.outputs) == 2

        assert os.path.exists("tstpkg/TestFact.py")
        execfile("tstpkg/TestFact.py")

        mypackage.write()
        assert os.path.exists("tstpkg/__wralea__.py")
        assert os.path.exists("tstpkg/__init__.py")
        execfile("tstpkg/__wralea__.py")

        # Test_clone_package
        path = os.path.join(os.path.curdir, "clonepkg")
        pkg2 = UserPackage("ClonePkg", metainfo, path)
        print pkg2.wralea_path

        # todo this is not working !!
        from openalea.core.pkgmanager import PackageManager
        pm = PackageManager()
        pm.add_wralea_path(path, pm.temporary_wralea_paths)
        pm.init()
        pkg2.clone_from_package(mypackage)
        pkg2.write()

        assert len(pkg2) == 1
        assert len(pkg2["TestFact"].inputs) == 3
        assert id(pkg2["TestFact"]) != id(mypackage["TestFact"])
        assert os.path.exists(path)
        assert os.path.exists(os.path.join(path, '__wralea__.py'))
        assert os.path.exists(os.path.join(path, '__init__.py'))
        assert os.path.exists(os.path.join(path, 'TestFact.py'))
Пример #5
0
def test_wraleapath():
    """test wraleapath"""
    pkgman = PackageManager()

# this option (include_namespace has been removed)
#    assert bool(openalea.__path__[0] in  \
#      pkgman.get_wralea_path()) == pkgman.include_namespace

    if(os.name == 'posix'):
        pkgman.add_wralea_path("/usr/bin", \
            pkgman.user_wralea_path)
        assert "/usr/bin" in pkgman.get_wralea_path()
    else:
        pkgman.add_wralea_path("C:\\Windows", \
            pkgman.user_wralea_path)
        assert "C:\\Windows" in pkgman.get_wralea_path()