pytest-dev / pytest-dev/pytest

Make tmp_path truncation configurable or longer

Open
#10,949 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

plugin: tmpdir topic: config
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

What's the problem this feature will solve?

Currently the tmp_path is truncated to 30 chars. For longer test names this removes the _<run> from the tmp_path. which is inconvenient

https://github.com/pytest-dev/pytest/blob/a15f54496293157b4c8f65164f86ba81c3d908a1/src/_pytest/tmpdir.py#L255

Describe the solution you'd like

Make this truncation length configurable or increase the max lenght (255 for example).

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 in src/_pytest/tmpdir.py around line 255 and inspect how tmp_path names are truncated. Decide whether the limit should be configurable or increased, then verify with tests that long test names retain the _ suffix and that the resulting path behavior matches the chosen limit.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.