tmux-python / tmux-python/libtmux

Perfect mocking mechanism

Open
#591 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.2k
Forks
127
Avg merge
2h 13m
Merged PRs (30d)
1

Description

Problem

Waiter (test_waiter) flakes a lot.

  • #373
  • #582
  • #583
  • #584

Proposal

For cases like Waiter, may we need an object to simulate shell responses perfectly for the sake of testing correct behavior of test_waiter.py

We're testing the correct behavior of Waiter

In this case, we want to be sure that in various instances, including simulated ones that are exact to real tmux use cases, waiter behaves as designed.

We want correct mocks

Examine mocking of subprocess responses. In the same way responses mocks requests, this would "tap in" at a low level, while also ensuring our existing tests using real tmux still work without any additional effort.

Maybe also permit real tests

Perhaps also allow e2e tests that use real tmux sessions in the backend too

We don't want to lose benefit of testing against real world scenarios:

  1. Existing fuzziness cause by environments, different shells
  2. Shell updates, OS updates
  3. Tmux updates

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading test_waiter.py and the existing subprocess mocking around Waiter, then review the linked flakiness issues for the real failure cases. Define a low-level mock for shell responses that models real tmux use cases while preserving existing real-tmux tests; done should include deterministic tests for Waiter behavior and a clear approach to optional real-session tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, shell
Domain
cli, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.