Example #1
0
        from rosdeb import parse_Packages, get_Packages
        s1 = get_Packages(SHADOW_REPO, 'lucid', 'amd64')
        parsed = parse_Packages(s1)
        # make sure there are some ros packages in the repo
        matches = [x for x in parsed if x[0].startswith('ros-')]
        self.assert_(len(matches))

    def test_load_Packages(self):
        from rosdeb import load_Packages
        parsed = load_Packages(SHADOW_REPO, 'lucid', 'amd64')
        # make sure there are some ros packages in the repo
        matches = [x for x in parsed if x[0].startswith('ros-')]
        self.assert_(len(matches))

    def test_deb_in_repo(self):
        from rosdeb import deb_in_repo, load_Packages
        parsed = load_Packages(SHADOW_REPO, 'lucid', 'amd64')
        self.assert_(
            deb_in_repo(SHADOW_REPO, parsed[0][0], parsed[0][1], 'lucid',
                        'amd64'))
        self.failIf(
            deb_in_repo(SHADOW_REPO, 'fake', parsed[0][1], 'lucid', 'amd64'))


if __name__ == '__main__':
    from ros import rostest
    rostest.unitrun('rosdeb',
                    'test_rosdeb_repo',
                    RepoTest,
                    coverage_packages=['rosdeb.repo'])
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
import roslib; roslib.load_manifest('vcstools')

import os
import sys
import unittest
import subprocess

import roslib

class LegacyVcsTest(unittest.TestCase):

    def test_svn_url_exists(self):
        from vcstools import svn_url_exists
        self.assert_(svn_url_exists('https://code.ros.org/svn/ros/'))
        self.assert_(svn_url_exists('https://code.ros.org/svn/ros/stacks/ros/trunk/CMakeLists.txt'))

        od = roslib.os_detect.OSDetect()
        if od.get_version() != "9.04":
            self.failIf(svn_url_exists('https://code.ros.org/svn/ros/stacks/ros/trunk/FAKEFILE.txt'))

if __name__ == '__main__':
    from ros import rostest
    rostest.unitrun('vcstools', 'test_vcs_legacy', LegacyVcsTest, coverage_packages=['vcstools.legacy_vcs'])  
        rosdeps = {}
        for platform in platforms:
            rosdeps[platform] = {}
            for stack_name in stacks:
                stack_dir = get_stack_dir(stack_name)
                
                rosdeps[platform][stack_name] = deps = stack_rosdeps(stack_name, stack_dir, platform)
                for reqd in base_reqd:
                    self.assert_(reqd in deps)

        tests = [
            ('ros', ['python-yaml']),
            ('ros_release', []),
            #('navigation', ['python-yaml', 'libnetpbm10-dev']),
            #('geometry', ['libglut3-dev', 'graphviz', 'python-sip4-dev', 'sip4']),
            ]

        # make sure common_msgs has no additional rosdeps
        for p in ['lucid', 'karmic', 'jaunty']:
            self.failIf(set(rosdeps[p]['common_msgs']) ^ set(base_reqd))

        for stack, reqd in tests:
            for r in reqd:
                for p in ['lucid', 'karmic', 'jaunty']:
                    self.assert_(r in rosdeps[p][stack], r)

if __name__ == '__main__':
    from ros import rostest
    rostest.unitrun('rosdeb', 'test_rosdeb_rosutil', RosutilTest, coverage_packages=['rosdeb.rosutil'])

        # this is cached, so it should always works
        self.assertEquals(s1, s2)
        # we will test parsing of this separately, just do a sanity check
        self.assert_('Package: ' in s1)
        
    def test_parse_Packages(self):
        from rosdeb import parse_Packages, get_Packages
        s1 = get_Packages(SHADOW_REPO, 'lucid', 'amd64')
        parsed = parse_Packages(s1)
        # make sure there are some ros packages in the repo
        matches = [x for x in parsed if x[0].startswith('ros-')]
        self.assert_(len(matches))

    def test_load_Packages(self):
        from rosdeb import load_Packages
        parsed = load_Packages(SHADOW_REPO, 'lucid', 'amd64')
        # make sure there are some ros packages in the repo
        matches = [x for x in parsed if x[0].startswith('ros-')]
        self.assert_(len(matches))

    def test_deb_in_repo(self):
        from rosdeb import deb_in_repo, load_Packages
        parsed = load_Packages(SHADOW_REPO, 'lucid', 'amd64')
        self.assert_(deb_in_repo(SHADOW_REPO, parsed[0][0], parsed[0][1], 'lucid', 'amd64'))
        self.failIf(deb_in_repo(SHADOW_REPO, 'fake', parsed[0][1], 'lucid', 'amd64'))        

if __name__ == '__main__':
    from ros import rostest
    rostest.unitrun('rosdeb', 'test_rosdeb_repo', RepoTest, coverage_packages=['rosdeb.repo'])

Example #5
0
        url = "https://github.com/tfoote/ros-get-test.git"
        branch = "master"
        gitc = git.GITClient(local_path)
        self.assertFalse(gitc.path_exists())
        self.assertFalse(gitc.detect_presence())
        self.assertTrue(gitc.checkout(url, branch))
        self.assertTrue(gitc.path_exists())
        self.assertTrue(gitc.detect_presence())
        self.assertEqual(gitc.get_path(), local_path)
        self.assertEqual(gitc.get_url(), url)
        self.assertEqual(gitc.get_branch_parent(), branch)
        
        new_branch = 'master'
        self.assertTrue(gitc.update(new_branch))
        self.assertEqual(gitc.get_branch_parent(), new_branch)
        
        shutil.rmtree(directory)
        self.directories.pop(subdir)


if __name__ == '__main__':
    from ros import rostest
    from roslib import os_detect
    os_detector = os_detect.OSDetect()
    if os_detector.get_name() == "ubuntu" and os_detector.get_version() == "9.04":
        print "jaunty detected, skipping test"
        rostest.unitrun('vcstools', 'test_git', FakeGITClientTest, coverage_packages=['vcstools'])
    else:
        rostest.unitrun('vcstools', 'test_git', GITClientTest, coverage_packages=['vcstools'])
    #setup_git_repo("/tmp/git")
Example #6
0
        self.assertTrue(bzrc.detect_presence())
        self.assertEqual(bzrc.get_path(), local_path)
        self.assertEqual(bzrc.get_url(), url)
        self.assertEqual(bzrc.get_version(), version)
        
        new_version = '2'
        self.assertTrue(bzrc.update(new_version))
        self.assertEqual(bzrc.get_version(), new_version)
        
        shutil.rmtree(directory)
        self.directories.pop(subdir)

class FakeBZRClientTest(unittest.TestCase):


    def test_get_url_by_reading(self):
        self.assertTrue("Test not running on Jaunty")



if __name__ == '__main__':
    from ros import rostest
    from roslib import os_detect
    os_detector = os_detect.OSDetect()
    if os_detector.get_name() == "ubuntu" and os_detector.get_version() == "9.04":
        print "jaunty detected, skipping test"
        rostest.unitrun('vcstools', 'test_vcs', FakeBZRClientTest, coverage_packages=['vcstools'])  
    else:
        rostest.unitrun('vcstools', 'test_vcs', BZRClientTest, coverage_packages=['vcstools'])  

Example #7
0
        diff = set(testval) ^ set(deb_depends(metadata, 'cturtle', 'lucid'))
        self.failIf(diff, diff)
        
    def test_control_file(self):
        import yaml
        metadata = yaml.load(yaml_control)
        from rosdeb.source_deb import control_file
        txt = control_file(metadata, 'cturtle', 'lucid')
        test = """Source: pr2-arm-navigation
Section: unknown
Priority: optional
Maintainer: Sachin Chitta
Build-Depends: debhelper (>= 5), chrpath, libc6, build-essential, cmake, python-yaml, subversion, ros-cturtle-arm-navigation, ros-cturtle-collision-environment, ros-cturtle-common-msgs, ros-cturtle-image-pipeline, ros-cturtle-kinematics, ros-cturtle-laser-pipeline, ros-cturtle-motion-planners, ros-cturtle-motion-planning-common, ros-cturtle-motion-planning-environment, ros-cturtle-pr2-common, ros-cturtle-pr2-controllers, ros-cturtle-pr2-kinematics, ros-cturtle-pr2-kinematics-with-constraints, ros-cturtle-ros, ros-cturtle-trajectory-filters
Standards-Version: 3.7.2

Package: pr2-arm-navigation
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libc6, build-essential, cmake, python-yaml, subversion, ros-cturtle-arm-navigation, ros-cturtle-collision-environment, ros-cturtle-common-msgs, ros-cturtle-image-pipeline, ros-cturtle-kinematics, ros-cturtle-laser-pipeline, ros-cturtle-motion-planners, ros-cturtle-motion-planning-common, ros-cturtle-motion-planning-environment, ros-cturtle-pr2-common, ros-cturtle-pr2-controllers, ros-cturtle-pr2-kinematics, ros-cturtle-pr2-kinematics-with-constraints, ros-cturtle-ros, ros-cturtle-trajectory-filters
Description: pr2_arm_navigation
 This stack contains the launch files for arm navigation with the PR2 robot arms."""

        for actual, real in zip(txt.split('\n'), test.split('\n')):
            self.assertEquals(actual, real)
            

if __name__ == '__main__':
    from ros import rostest
    rostest.unitrun('rosdeb', 'test_rosdeb_source_deb', SourceDebTest, coverage_packages=['rosdeb.source_deb'])

Example #8
0
                stack_dir = get_stack_dir(stack_name)

                rosdeps[platform][stack_name] = deps = stack_rosdeps(
                    stack_name, stack_dir, platform)
                for reqd in base_reqd:
                    self.assert_(reqd in deps)

        tests = [
            ('ros', ['python-yaml']),
            ('ros_release', []),
            #('navigation', ['python-yaml', 'libnetpbm10-dev']),
            #('geometry', ['libglut3-dev', 'graphviz', 'python-sip4-dev', 'sip4']),
        ]

        # make sure common_msgs has no additional rosdeps
        for p in ['lucid', 'karmic', 'jaunty']:
            self.failIf(set(rosdeps[p]['common_msgs']) ^ set(base_reqd))

        for stack, reqd in tests:
            for r in reqd:
                for p in ['lucid', 'karmic', 'jaunty']:
                    self.assert_(r in rosdeps[p][stack], r)


if __name__ == '__main__':
    from ros import rostest
    rostest.unitrun('rosdeb',
                    'test_rosdeb_rosutil',
                    RosutilTest,
                    coverage_packages=['rosdeb.rosutil'])
Example #9
0
        for bt in ['boxturtle', 'boxturtle-v2']:
            boxturtle = distros[bt]
            self.assertEquals(['base', 'pr2'], get_variants(boxturtle, 'ros'))
            self.assertEquals(['base', 'pr2'],
                              get_variants(boxturtle, 'navigation'))
            self.assertEquals(['pr2'], get_variants(boxturtle,
                                                    'pr2_mechanism'))
            self.assertEquals([], get_variants(boxturtle, 'arm_navigation'))
            self.assertEquals([], get_variants(boxturtle, 'fake'))

        # latest tests
        for l in ['latest', 'latest-v2']:
            latest = distros[l]
            self.assertEquals(['base', 'pr2', 'pr2all'],
                              get_variants(latest, 'ros'))
            self.assertEquals(['base', 'pr2', 'pr2all'],
                              get_variants(latest, 'navigation'))
            self.assertEquals(['pr2', 'pr2all'],
                              get_variants(latest, 'pr2_mechanism'))
            self.assertEquals(['pr2all'], get_variants(latest,
                                                       'arm_navigation'))
            self.assertEquals([], get_variants(latest, 'fake'))


if __name__ == '__main__':
    from ros import rostest
    rostest.unitrun('rosdistro',
                    'test_rosdistro',
                    DistroTest,
                    coverage_packages=['rosdistro'])