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

Sanitize test names created by pytest-flakefinder #201

Closed

Conversation

pamarcos
Copy link

@pamarcos pamarcos commented Jan 5, 2023

Remove the [N] suffix from test names to consider all tests the same so that testmon works well with test names generated by flakefinder.

This closes #200

I'm not sure this is the most elegant way of doing it, but it definitely does the trick. I'd love to hear some feedback about how to make testmon play nicely with flakefinder 🤗

Of course, this only fixes the problem to deselect all duplicated tests generated by flakefinder. They're still stored in the DB as they are. I didn't change the name used to store them because I didn't know for sure whether we could have duplicated entries or if it was assumed they were unique.

image

Remove the `[N]` suffix to consider all tests the same so that
testmon works well with test names generated by flakefinder.
@tarpas
Copy link
Owner

tarpas commented Jan 5, 2023

Hi Pablo. It's unlikely I'll merge something hacky, which your solution seems to be. What I'm open to explore is why it doesn't work out of the box.

I think we should work with the pytest_generate_tests (https://github.com/dropbox/pytest-flakefinder/blob/f6fb30fac91d6e85b6a712cf2a1266654a6c14e7/pytest_flakefinder.py#L59) just fine.

I'll have to study a little bit what is the order of collection, tests generation and collection modification hooks. I think it can be made to work in a better way. Your solution is bound to negatively interact with other plugins.

@pamarcos
Copy link
Author

pamarcos commented Jan 5, 2023

Thanks for taking a look at it, Tibor. I completely agree with you.

As I said in the issue, I think it is hacky indeed 😅

It is the workaround I did in local to make tesmon work with flake-finder, and since I am going to be some days off, I preferred to open the issue and submit what I had for now.

I think we should work with the pytest_generate_tests (https://github.com/dropbox/pytest-flakefinder/blob/f6fb30fac91d6e85b6a712cf2a1266654a6c14e7/pytest_flakefinder.py#L59) just fine.

The problem is that while flake-finder uses tryfirst=True, testmon uses trylast=True. I also thought that maybe passing a parameter in the CLI to set that to a different value might be helpful.

@pamarcos pamarcos closed this Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for pytest-flakefinder's test names
2 participants