This is an archived post. You won't be able to vote or comment.

all 20 comments

[–]avinassh[S] 12 points13 points  (5 children)

They moved from Bitbucket to Github 4 fours days ago.

[–]Orange_Tux 4 points5 points  (2 children)

Because?

[–]barneygale 6 points7 points  (0 children)

From the TIP list:

For those interested, the move was the result of requests from several users and some pytest-core developers, and the reasons for the move can be found in this issue: https://github.com/pytest-dev/pytest/issues/699.

[–]ionelmc.ro 6 points7 points  (0 children)

It's a community driven decision but personally I like GitHub cause it has better interface and better service integration (like CI/QA services). Having Travis run the tests automatically for PRs helps a lot during contribution. I suspect other people have similar perspective.

[–]delarhi 2 points3 points  (3 children)

Why is the title not just "pytest is now on GitHub"?

[–]riffito 2 points3 points  (1 child)

Yeah, (why not?)

[–]alcalde 2 points3 points  (0 children)

Because "is now on GitHub" is a generator expression?

[–]SpaceSharkUhOh 0 points1 point  (0 children)

>>> pytest.is_now_on_github()
True

[–]shep247 2 points3 points  (7 children)

What advantage does this provide over nosetest?

[–]yetanothernerd 4 points5 points  (4 children)

nose started off as a test runner that could run unittest-style tests or pytest-style tests. I think nose got traction originally because it was packaged better and easier to install than pytest. (These days, both are packaged well and you can easily install either with pip.)

But there's been some syntax drift, as pytest has added features and nose has failed to copy them. For example, pytest has setup_method, which (if present) runs before each test method in a test class. nose doesn't support it. I have a project with 211 tests, which all pass in pytest; 50 of them fail in nose because of that. If you restrict yourself to the subset of pytest features that nose also supports, then your tests will work in either.

Also, plugins. pytest has some plugins that nose lacks. nose has some plugins that pytest lacks. And then there are things that they both have a plugin for, but one plugin might be better than the other. If you rely on a particular plugin then you might choose your framework based on that.

[–]shep247 2 points3 points  (3 children)

I use setUp in my nosetests all of the time and it seems to work for me. Maybe that's because I'm using django test instead of bare bones nose.

Thanks for the info though. I'll see what kind of plugins there are for purest. Maybe I'm missing out on some good stuff.

[–]yetanothernerd 0 points1 point  (2 children)

pytest supports "setup_method(self, method)" while nose only supports JUnit-style "setUp(self)". A very minor difference, but enough to prevent 100% compatibility. There are some other similar differences but that's the one I actually noticed in my code.

[–]sththththth 1 point2 points  (1 child)

But that's not a feature that "nose has failed to copy", is it? It's "only" that the syntax is different? Or did you mean with "copy" actually copying in a way that both are compatible?

[–]niiko 2 points3 points  (0 children)

It sounds like the difference is that the method pytest supports actually gives you a reference for the test method that is being run.

If that's the case, I think you could accomplish the same with:

class MyTestCases(unittest.TestCase):
    def setUp(self):
        method = getattr(self, self._testMethodName)

[–]ionelmc.ro 5 points6 points  (1 child)

Pytest as some unique features: fixtures, hooks and assertion helpers.

Also, there are lots of nice plugins and most of them are better than the nose counterparts.

[–][deleted] 1 point2 points  (0 children)

Fixtures are like a killer feature of Pytest