def test_convert_html_to_text(self):
     import roslib.stacks
     from rosdeb.rosutil import convert_html_to_text
     from roslib.stack_manifest import parse_file, stack_file
     for stack_name in roslib.stacks.list_stacks():
         stack_xml = stack_file(stack_name)
         m = roslib.stack_manifest.parse_file(stack_xml)
         converted = convert_html_to_text(m.description)
         # some stacks do in fact have empty descriptions
         if stack_name in ['ros', 'common_msgs', 'navigation', 'geometry']:
             self.assert_(converted)
             
         # hard to actually validate output stable-y
         if stack_name == 'ros_release':
             self.assert_('* rosinstall' in converted, converted)
             self.assert_('* Debian toolchains' in converted, converted)
             self.assert_('p>' not in converted)                
             self.assert_('<ul>' not in converted)                
Пример #2
0
    def test_convert_html_to_text(self):
        import roslib.stacks
        from rosdeb.rosutil import convert_html_to_text
        from roslib.stack_manifest import parse_file, stack_file
        for stack_name in roslib.stacks.list_stacks():
            stack_xml = stack_file(stack_name)
            m = roslib.stack_manifest.parse_file(stack_xml)
            converted = convert_html_to_text(m.description)
            # some stacks do in fact have empty descriptions
            if stack_name in ['ros', 'common_msgs', 'navigation', 'geometry']:
                self.assert_(converted)

            # hard to actually validate output stable-y
            if stack_name == 'ros_release':
                self.assert_('* rosinstall' in converted, converted)
                self.assert_('* Debian toolchains' in converted, converted)
                self.assert_('p>' not in converted)
                self.assert_('<ul>' not in converted)
Пример #3
0
    def test_control_data(self):
        import roslib.stacks
        from roslib.stack_manifest import parse_file, stack_file
        
        from rosdeb import debianize_name
        from rosdeb.source_deb import control_data
        import rosdeb.rosutil 

        stack_version = '1.2.3'
        for stack_name in ['ros', 'navigation', 'simulator_gazebo', 'geometry', 'common', 'pr2_common']:
            if stack_name == 'sandbox':
                continue

            print "TESTING", stack_name

            stack_xml = stack_file(stack_name)
            d1 = control_data(stack_name, stack_version, 'fakemd5', stack_xml)
            d2 = control_data(stack_name, stack_version, 'fakemd5')

            self.assertEquals(d1, d2)

            self.assertEquals(d1['stack'], stack_name)
            self.assertEquals(d1['package'], debianize_name(stack_name))
            self.assertEquals(d1['version'], stack_version)
            
            self.assert_(d1['description-brief'] is not None)
            self.assert_(len(d1['description-brief']) <= 60)

            self.assert_(d1['rosdeps'] is not None)

            if stack_name == 'common_msgs':
                self.assertEquals(['ros'], d1['depends'])
                try:
                    self.assertEquals(rosdeb.rosutil.IMPLICIT_DEPS, d1['rosdeps']['lucid'])
                except:
                    self.fail(d1['rosdeps'])
Пример #4
0
def send_email(smtp_server, from_addr, to_addrs, subject, text):
    import smtplib
    from email.mime.text import MIMEText

    msg = MIMEText(text)

    msg['From'] = from_addr
    msg['To'] = to_addrs
    msg['Subject'] = subject

    s = smtplib.SMTP(smtp_server)
    print 'Sending mail to %s'%(to_addrs)
    try:
        s.sendmail(msg['From'], [msg['To']], msg.as_string())
    except Exception, ex:
        print "Sending email failed with exception: %s" % ex
    s.quit()

if __name__ == '__main__':
    import roslib.stacks
    from rosdeb.rosutil import convert_html_to_text
    from roslib.stack_manifest import parse_file, stack_file
    for stack_name in roslib.stacks.list_stacks():
        stack_xml = stack_file(stack_name)
        m = roslib.stack_manifest.parse_file(stack_xml)
        if stack_name in ['ros_release']:
            print '='*80
            print stack_name
            print convert_html_to_text(m.description)