Hacker Newsnew | past | comments | ask | show | jobs | submit | hyperzeit's commentslogin

To me, this alone could also be a collider/Berkson's paradox: Conditioning on making the cut, there is a negative correlation because you make the cut by either being extremely skillful or by having great certifications – one compensates the other. That in turn would mean that certifications are actually positively correlated with getting employed at Google.

You need the full picture, that is people not making the cut to exclude this pattern.


How come, pytest does not appear in the post?


the post covers the built-in unittest package, which 28% of devs still use. But pytest is nicer to work with. I think brownfield codebases and inertia are the reason 28% of devs work (or have to work) with unittest


Pytest easily runs unittest codebases, and you can just start writing new tests in pytest, and gradually move to it. Most of those left in pure unittest land are probably in some category of "amount of legacy is too large" or "I don't care anymore", and most probably some amount of both.


I actually prefer unittest style tests to pytest. I hop between languages a lot and find them easier to remember how to write when I'm doing Python. I also place a lot of value on minimizing the dependencies that I have to install and every codebase I see using pytest seems to also have to pull in a dozen other pytest plugins that then have to be reviewed, pinned, and updated. I also feel like whatever niceties pytest brings in to make writing tests easier are balanced out on Django apps by having to add a `@pytest.mark.django_db` decorator on basically every single test function.


Regarding Django, if you add `pytestmark = pytest.mark.django_db` to the top of your file or organize your tests in classes and decorate those, then you won't have to decorate every single test :)


I mean, pytest ones are the easiest. They are just functions. If you're not doing anything fancy, then you don't need to do anything else. Use normal assert, not some fancy functions. Only plugin I really use is coverage.

Minimizing runtime dependencies is nice, but personally I couldn't care less about build/test time dependencies.

I don't touch Django so can't comment on that though.


unittest is included in the Python standard library. Adding third-party libraries is a huge step to take for a project, and just “nicer to work with” does not cut it. Third-party libraries come and go, and depending on one means being subject to the storms of changes and lulls of inactivity and death. But the standard library is dependable.


> Adding third-party libraries is a huge step to take for a project

Really? I've can't think of a "real" project that did not include 3rd party libs.

Reinventing wheels or struggling with poorer implementations (unittest vs pytest, http vs requests, etc) is huge drain for a project. A huge misstep.


I should have written “Adding each extra third-party library as an additional dependency is always a huge step to take for a project”.

Any one third-party library comes with these drawbacks, and each library must be evaluated individually. Some may be worth the pain (requests, etc.), but many are not. One should try to minimize the number of third-party dependencies one has, not necessarily eliminate them entirely. It’s simply that the lower number of third-party libraries you depend on, the less pain you get of the kinds I listed. Every individual third-party library will have to overcome that threshold by being useful enough. And I doubt that, for most people, pytest is that much better to work with than the built-in unittest is.


From the article:

> While pytest is very popular, 28% of codebases still use the built-in unittest package.


Yes? This proves that the writer thinks that everybody should obviously change from unittest to pytest. It does not prove the writer to be correct in all circumstances. Each project should make their own determination of whether a third-party library is worth it.


No, that doesn't prove that. It just indicates the opposite of what you said, here:

> And I doubt that, for most people, pytest is that much better to work with than the built-in unittest is.


Then why did you quote the author so selectively as to appear to indicate the opposite?


Sorry, I'm not following. I'm saying the article says less than 30% of repos scanned used Unittest. That was in response to you seeming to say that most projects would choose Unittest.

What've I missed?


Oh, I see, you misunderstood me. I did not claim that “most projects would choose Unittest”. I claimed that for many projects, it would be wise to consider using unittest instead of, for example, pytest, as a way of minimizing usage of third-party modules.


> Every individual third-party library will have to overcome that threshold by being useful enough. And I doubt that, for most people, pytest is that much better to work with than the built-in unittest is.

This sounds more like you're saying that pytest wouldn't overcome that threshold; I was saying that has already happened, at least according to the article's statement.


Maybe. But I would personally guess that most people nowadays are way too eager to use a new library than would be good for their projects in the long run. I very much doubt that most new libraries are that much better than the Python standard library counterparts that it’s worth using them in non-toy projects. Of course, all progress depends on the unreasonable man, etc.


But a login is not the same as a truly active user/customer. At least in my bubble, people log in/open the app out of FOMO, check if there is anything new, most likely find nothing intriguing, and log out/close the app again. Rinse and repeat every week.


You are confusing p(psychosis|cannabis) with p(cannabis|psychosis)


One of the scores of lists people share and bookmark but never use themselves.


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

Search: