如何使用travis-ci.org测试需要键盘输入的项目?

How to test a project that need keyboard input with travis-ci.org?

我正在尝试在 travis-ci(持续集成平台)中测试一个简单的菜单算法,该算法等待用户输入以执行任务 (CRUD) 喜欢:

显示、添加、删除、更新注册表或退出。

示例代码如下:

Python Code

这是我的 .travis.yml 文件:

language: python
python:
  - "2.6"
  - "2.7"
  - "3.2"
  - "3.3"
  - "3.4"
  - "3.5"
  - "3.5-dev" # 3.5 development branch
  - "nightly" # currently points to 3.6-dev
# command to install dependencies
# install: "pip install -r requirements.txt"
# command to run tests
script: 
  - python 1aula_agenda.py

这是 travis-ci.org 的输出:

0.00s$ source ~/virtualenv/python2.7/bin/activate
$ python --version
Python 2.7.9
$ pip --version
pip 6.0.7 from /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages (python 2.7)
Could not locate requirements.txt. Override the install: key in your .travis.yml to install dependencies.
$ python 1aula_agenda.py
0. Visualizar
1. Inserir um contato
2. Remover um contato
3. Alterar um contato
4. Sair do programa
Escolha uma opcao: 
No output has been received in the last 10 minutes, this potentially indicates a stalled build or something wrong with the build itself.
The build has been terminated

我怎样才能使 travis 测试所有选项 01 2, 3, 4 并在选项 1 和3?

可以创建一个带有电池测试的文件testing.txt来测试程序的功能。

testing.txt 包含程序所需的键盘输入。 例如测试你的例子

0
1
"John Smith"
"1235-5387"
0
4

并在 .travis.yml 文件中包含 testing.txt:

language: python
python:
  - "2.6"
  - "2.7"
  - "3.2"
  - "3.3"
  - "3.4"
  - "3.5"
  - "3.5-dev" # 3.5 development branch
  - "nightly" # currently points to 3.6-dev
# command to install dependencies
# install: "pip install -r requirements.txt"
# command to run tests
script: 
  - python 1aula_agenda.py < testing.txt