Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Label] Allow specifying full directories/files as order targets #51

Open
Joacchim opened this issue Aug 5, 2021 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@Joacchim
Copy link

Joacchim commented Aug 5, 2021

Hello,

I've been fiddling with pytest-order for a personal project.
I wanted to order tests based on files and/or subdirectories, and I believe that it is not feasible at the moment with pytest-order.

Looking a bit into it, I've observed (correct me if I'm misunderstanding something) that the labels should mostly hint at discrete tests, and never at a bunch of other tests (all tests from a directory, file).

Is it possible to provide a feature such as full directory/file-based ordering ? I felt it should be, since the module already supports specifying multiple tests as before/after ordering labels.

I believe it may relate to #50, as the subject matter might end up cross paths.

Note: I've fiddled a bit with the code to obtain something that looks like it might work, but I might also be unknowingly passing-by some major problematics in doing so. If you're interested nonetheless, I can provide an initial PR to serve as a discussion basis, and hopefully contribute to obtaining said feature.

Cheers !

@ltrujello
Copy link

@Joacchim would you mind sharing your stab at implementing this feature? I am also interested.

In my opinion, this feature would be much cooler than what pytest-order currently offers.

It is actually much more useful to specify the order your test files run rather than the individual tests. E.g., most projects that are complicated enough to have tests usually have hundreds of tests. Are the developers really going to label the order of every singe test function? Probably not, that's just too complicated. It'd be much more useful to order the files that the hundreds of tests are split up between.

For context my use case: I would like my very slow integration test file to run last. Because of alphabetical ordering, they run first. Thus, every time I make a new, fast test, I have to wait for my slow integration tests to run first. I still want that test to run of course, but it'd be more useful for my newly added fast test to fail first (failing fast helps you iterate faster).

@mrbean-bremen
Copy link
Member

mrbean-bremen commented Mar 1, 2023

@ltrujello - have a look at this question for your problem. I know it's not ideal, but at least it will work.
For the work @Joacchim has started - see his PR #52. If you want to have a shot, you can take that as a base. It is unlikely that I will get to it myself very soon, as I am busy with other projects at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants