예제 #1
0
def main():
    opts, args = _get_opt()
    reflesh_config(opts.config)
    if opts.debug is not None:
        __conf__.DEBUG = opts.debug
    
    Service(host=__conf__.CACHE_HOST or opts.host, channel=__conf__.SERVICE_CHANNEL or opts.channel,
            callback=_show_info).run()
예제 #2
0
def main():
    opts, args = _get_opt()
    reflesh_config()
    if opts.debug is not None:
        __conf__.DEBUG = opts.debug

    Service(
        host=opts.host, channel=opts.channel, callback=_show_info).run()
예제 #3
0
def main():
    opts, args = _get_opt()
    reflesh_config(opts.config)
    if opts.debug is not None:
        __conf__.DEBUG = opts.debug

    Service(host=__conf__.CACHE_HOST or opts.host,
            channel=__conf__.SERVICE_CHANNEL or opts.channel,
            callback=_show_info).run()
예제 #4
0
파일: bktool.py 프로젝트: comger/kpages

def _get_opt():
    parser = OptionParser("%prog [options]", version="%prog v0.9")
    parser.add_option("--config", dest="config",
                      default='setting.py', help="config for app")
    parser.add_option("--test", dest="test", default=None, help="utest module")
    parser.add_option(
        "--pro", dest="pro", default=None, help="profile for method")
    return parser.parse_args()

if __name__ == "__main__":
    try:
        set_default_encoding()
        opts, args = _get_opt()
        reflesh_config(opts.config)

        if opts.test is not None:
            m = opts.test
            if m == 'all':
                m = None
            with LogicContext():
                run_test(m)

        elif opts.pro is not None:
            with LogicContext():
                pro_test(opts.pro)

    except KeyboardInterrupt:
        print('exit tool ')
예제 #5
0

class DemoCase(TestCase):
    def setUp(self):
        pass

    def test_upadte(self):
        r,parents =  m_page('city',size = 1000, parent=None)
        for i,item in enumerate(parents):
            m_update('city',item.get('_id'),id=i)
            r,rs = m_page('city',size=1000,parent=item.get('_id'))
            for n,city in enumerate(rs):
                m_update('city',city.get('_id'),id=int(str(i)+str(n)))
                r,items = m_page('city',size=1000,parent=city.get('_id'))
                for m,_city in enumerate(items):
                    m_update('city',_city.get('_id'),id=int(str(i)+str(n)+str(m)))


        print 'update end'
        parents =  m_page('city',level=0,parent=None)
        print parents
        

if __name__ == '__main__':
    from pyquery import PyQuery as pyq
    case = CityCate()
    reflesh_config('setting.py')
    with LogicContext():
        case.test_add()

예제 #6
0
                    rr, vv = add(c['name'], v['_id'], 1)
                    xs = self.get_citys(c['id'])
                    for x in xs:
                        print '****', x['name']
                        rrr, vvv = add(x['name'], vv['_id'], 2)

    def get_citys(self, fid=0):
        url = self._url.format(fid)
        doc = pyq(url=url)
        text = doc.text()[21:-1]
        try:
            return json.loads(text)
        except:
            print text
            return []


class DemoCase(TestCase):
    def setUp(self):
        pass

    def testprint(self):
        print m_page('city')


if __name__ == '__main__':
    case = CityCate()
    reflesh_config('setting.py')
    with LogicContext():
        case.test_add()
예제 #7
0
                      dest="config",
                      default='setting.py',
                      help="config for app")
    parser.add_option("--test", dest="test", default=None, help="utest module")
    parser.add_option("--pro",
                      dest="pro",
                      default=None,
                      help="profile for method")
    return parser.parse_args()


if __name__ == "__main__":
    try:
        set_default_encoding()
        opts, args = _get_opt()
        reflesh_config(opts.config)

        if opts.test is not None:
            m = opts.test
            if m == 'all':
                m = None
            with LogicContext():
                run_test(m)

        elif opts.pro is not None:
            with LogicContext():
                pro_test(opts.pro)

    except KeyboardInterrupt:
        print 'exit tool '