Exemplo n.º 1
0
def test_send_fn():
    client_info = dict(package='test-underway2', arch='fooarch2',
                       success=True)
    results = (client_info, [])

    x = pbc.get_tagsets_for_package(rpc_url, 'test-underway2')
    assert len(x) == 0
    
    pbc.send(rpc_url, results, hostname='testhost2', tags=('b_tag',))

    x = pbc.get_tagsets_for_package(rpc_url, 'test-underway2')
    assert len(x) == 1
Exemplo n.º 2
0
    def execute(self, argv):
        self.options, self.args = pony.parse_cmdline(argv)

        # Figure out the python version and tags
        py_version = ".".join(str(p) for p in sys.version_info[:2])
        self.py_name = 'python%s' % py_version
        self.tags = [self.py_name, 'base_builder']

        ###
        self.server_url = 'http://devmason.com/pony_server/xmlrpc'
        if not self.options.force_build:
            if not pony.check(self.name, self.server_url, tags=self.tags):
                print 'check build says no need to build; bye'
                sys.exit(0)

        self.context = pony.VirtualenvContext(self.options.cleanup_temp, self.required)
        self.setup()
        self.define_commands()
        results = pony.do(self.name, self.commands, context=self.context)
        client_info, reslist = results


        if self.options.report:
            print 'Result: %s; sending' % (client_info['success'],)
            pony.send(self.server_url, results, tags=self.tags)
        else:
            print
            print "-"*60
            print 'Build results:'
            print '(not sending build results to server)'
            print
            print "Client info:"
            for (k, v) in client_info.items():
                print "  %s: %s" % (k, v)
            print
            print "Build details:"
            for i, step in enumerate(reslist):
                print "  Step %s: %s" % (i, step['name'])
                for k, v in step.items():
                    print "    %s: %s" % (k, v)

        if not client_info['success']:
            return -1
        return 0