Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm still reading, but I just got to the part about flaky, and I got annoyed because there are clear use cases for flaky or pytest-retry.

If you have an integration test that relies on an unreliable system you do not control. Sure you can mock it out for a unit test, but if you want to make sure you catch breaking API changes, you need to hit the actual system. And if it works after retrying it a few times, then so be it. no need to throw shade.



I'm going to push back and say that test is not a valuable automatic test. The phrase "relies on an unreliable system" captures that lack of value.


When the code your testing is a client for some remote API, and the sandbox/development/Testing version of that API doesn't have the same resources and uptime guarantee as production, then what are your options? as far as I can tell they are:

Don't test it.

Only do unit tests with the connection mocked out.

Test against production.

Try it a few times with a delay, and if it works then you know your code is good and you can move on with your deployment. Which is what flaky and pytest-retry do.

Maybe I'm missing something, but out of those 4 options retrying the test seems like the best one, with the big caveat that it is only viable if the test does indeed work after trying a few times. I really don't see any downside.

edit:

Maybe another option is to put the retry functionality directly in the client code, which would make your code more robust overall. but that is definitely more complex than using one of these libraries just for testing.


You're on the right track. It's a perennial favorite of devs to abhor flakyness, whereas after spending enough time as a tester, you come to terms with the fact that you have to take your tests as a statistical probe because most places test systems are simply not that reliable; sometimes, this is even a design feature.

This experience as a tester is in fact a normalization of deviance from the ideal computation model of a developer. Everything should work the first time everytime from their point of view. The tester sees reality as it is. The Emperor won't fund my test systems sufficiently to service all my customers, so we make do ss best we can. Bonus points in that we get to exercise the edge cases.


I think the issue is people using it when they’re too lazy to fix the test case.


I find quite interesting that people will prefer a highly malleable language like Python, and then orgs have to adopt testing to get around all the inconsistencies caused by absent type system. And then people will write libraries to get around the pesky tests to get their flexibility back.

It's fascinating really... Complex systems are always in partial failure mode and that applies to collective optimization challenges. Organizations will always be stuck in local optima in most domains.


Type systems do not replace testing, and if a test works after retrying it then it is probably not something that a type system would be able to catch.


> Type systems do not replace testing

They're a good substitute for many of the use cases of testing.

> if a test works after retrying it then it is probably not something that a type system would be able to catch.

Type systems are pretty good at catching incorrect concurrency logic these days, and getting better all the time.


Yes they are not equivalent, but creating languages without a strict type system and the proposition of test driven development are going back and fort in strictness. It is beneficial to have a more strict programming language, but it can be uncomfortable and burdensome. So I find interesting we keep going back and forth in this dimension.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: