vendredi 17 avril 2020

Test interactive CLI in Python

I created a package for users to interact with the CLI via a series of questions (something similar to PyInquirer). The prompts are created via Prompt Toolkit.

In addition to unit tests, I want to be able to test some of these prompts end-to-end, meaning:

  • A prompt with multiple choices (A, B and C) is created.
  • The mock-user presses the down-arrow button twice.
  • The mock-user presses Enter.
  • The prompt returns C.

I'm currently using PyTest for the testing.

Aucun commentaire:

Enregistrer un commentaire