pytest-dev / pytest-dev/pytest

LineMatcher: add option to match all lines

Open
#6,820 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

plugin: pytester type: enhancement
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

In https://github.com/pytest-dev/pytest/pull/6653 consecutive was added, which allows to ensure that the subset of lines is matched consecutively.

However, it would also be useful to have a mode that ensures that all expected
lines are in the output, e.g. complete=True: LineMatcher(["unexpected", "1", "2", "3"]).fnmatch_lines(["1", "2", "3"], complete=True) should fail then (since "unexpected" was not asserted).

Given that consecutive has not been released and that it overlaps (since complete would imply consecutive) it might be worth to change this into a more generic mode argument.

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 at the LineMatcher.fnmatch_lines entry point and review the existing consecutive behavior introduced by pull request #6653. Decide how a complete or more generic mode should cover all expected lines, then verify that the example with an unexpected line fails and add regression coverage for the selected API.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.