Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement with_testsui replacement as fixture #423

Closed
mih opened this issue Jun 18, 2023 · 0 comments · Fixed by #427
Closed

Implement with_testsui replacement as fixture #423

mih opened this issue Jun 18, 2023 · 0 comments · Fixed by #427
Assignees

Comments

@mih
Copy link
Member

mih commented Jun 18, 2023

with_testui is useful for passing precrafted user input to code for user interaction. However, the implementation in datalad-core fully replaced the UI and is not just passing the inputs. This makes it impossible to implement that aim to ensure a particular user interaction (flow of questions and responses), because no output is generated and fixtures like capsys of capfd cannot be used.

@mih mih self-assigned this Jun 21, 2023
mih added a commit to mih/datalad-next that referenced this issue Jun 21, 2023
@mih mih mentioned this issue Jun 21, 2023
2 tasks
mih added a commit to mih/datalad-next that referenced this issue Jun 21, 2023
mih added a commit to mih/datalad-next that referenced this issue Jun 21, 2023
This provides two fixtures

- `datalad_interactive_ui`
- `datalad_noninteractive_ui`

that can be used to test user interaction or communication sequences.
Unlike the datalad-core test UI, this is not only provisioning
user input. In addition, it allows for inspecting a detailed UI
call log, and offers a text-rendering to easy debugging:

```
(Pdb) print(iu)
InteractiveTestUI(
  question: (('attr1',), {'title': 'dummyquestion'})
  response: attr1
  question: (('attr2',), {'title': None})
  response: attr2
  question: (('secret',), {'title': None, 'repeat': True, 'hidden': True})
  response: secret
  (unused responses: [])
)
```

Closes datalad#423
mih added a commit to mih/datalad-next that referenced this issue Jun 21, 2023
This provides two fixtures

- `datalad_interactive_ui`
- `datalad_noninteractive_ui`

that can be used to test user interaction or communication sequences.
Unlike the datalad-core test UI, this is not only provisioning
user input. In addition, it allows for inspecting a detailed UI
call log, and offers a text-rendering to easy debugging:

```
(Pdb) print(iu)
InteractiveTestUI(
  question: (('attr1',), {'title': 'dummyquestion'})
  response: attr1
  question: (('attr2',), {'title': None})
  response: attr2
  question: (('secret',), {'title': None, 'repeat': True, 'hidden': True})
  response: secret
  (unused responses: [])
)
```

Closes datalad#423
@mih mih closed this as completed in #427 Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant