Skip to content

truncation_limit_lines and truncation_limit_chars should accept integer values in .toml configs #14675

Description

@5j9

I think in pyproject.toml and pytest.toml, pytest should accept integer values rather than strings. Currently it's the other way around - I get a type error when using integers and have to use strings.

E   TypeError: ...\pyproject.toml: config option 'truncation_limit_lines' expects a string, got int: 1000000

or

E  TypeError: ...\pyproject.toml: config option 'truncation_limit_chars' expects a string, got int: 0

Steps to reproduce:

  1. In pyproject.toml add:
[tool.pytest]
truncation_limit_lines = 0
truncation_limit_chars = 0
  1. Sample test:
def test_failure():
    assert {1: 2} == {3: 4}

Current behavior:

  • Integers cause a TypeError

Expected behavior:

  • Integers should be accepted (these are numeric limits)

Environment:
pytest version: 9.1.1, Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions