How to test Python readline completion?

前端 未结 4 1183
借酒劲吻你
借酒劲吻你 2021-02-19 13:25

I\'m writing a command-line interface in Python. It uses the readline module to provide command history and completion.

While everything works fine in interactive mode,

4条回答
  •  不知归路
    2021-02-19 14:18

    Check out ScriptTest:

    from scripttest import TestFileEnvironment
    env = TestFileEnvironment('./scratch')
    
    def test_script():
        env.reset()
        result = env.run('do_awesome_thing testfile --with extra_win --file %s' % filename)
    

    And play around with passing the arguments as you please.

提交回复
热议问题