pytest-dev / pytest-dev/pytest-order

[Labels] Cannot specify Full-Class ordering from another file

Open
#50 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
210
Forks
17
Avg merge
16h 8m
Merged PRs (30d)
4

Description

Hello,

In order to order the tests of a personal project, I've attempted to order tests on the basis of files (or the classes within it), in order to keep the ordering specification short and concise. Note that I've also encountered issues ordering tests in a similar way to the documentation, by specifying a class name as the label.

Alas, it seems that is does not work this way (or is not intended to ?), as I only receive a Warning telling me that the mark is ignored, in light of the failure to match a node_id with the provided label.

Looking a bit into the code, I noticed that the code path handling Class-based dependencies has the constraint of containing exactly two :: strings, meaning that it must probably be a test-name from within a specific test-class.

I believe that it would be quite practical to be able to order tests relatively to test classes, not only from the same file, but also from other test files, as the documentation does not hint at the impossibility to do so.

Thank you for maintaining this piece of code, in hope that my feedback here may help the project and other users !

Contributor guide

No contributing guide indexed for this repository

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 with the code path handling class-based dependencies and its node_id matching constraint. Trace how labels are resolved across test files, then check the documentation's class-label behavior. Done means a class in another test file can be used for ordering without the warning that the label is ignored.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.