Closed moskytw closed 9 years ago
Although this is more of a personal thing, and I'm not advocating for any specific testing tool, I suggest using pytest. One benefit of it is that it has really good assert rewriting which makes it possible to write tests such as:
variable = function()
assert variable == 1
And still get good feedback from the unit testing system rather than a plain AssertionError
. Furthermore, py.test
has a really good fixtures system that enables you to write really clean code, without having to do any test-case inheritance unless your needs are a little special. You can also use both functions and classes in your code:
class TestFunction:
def test_one_is_given(self):
assert f(1) == 2
def test_function():
assert f(1) == 2
Lastly it seems that more projects are using pytest compared to nose, so chances are that more developers are more familiar with pytest which means more people would be comfortable with contributing to the code.
I remember nose can do all the things you mentioned. Cloud you provide more references about pytest is better than nose?
I’ll admit that documentation on Nose is sparse (putting it mildly) compared to pytest. I can’t say too much about Unicode tracebacks, but since Python 2 is terrible at this in general I’d say using non-ASCII characters in tracebacks is not a good idea in most cases.
The thing is, there are already tests written with Nose, and somebody needs to convert them to pytest test cases if we’re to make the switch. This includes all tests inside the tests
directory (no many), and a nose plugin that runs Sphinx doctests inside Nose. AFAIK no such plugin on pytest exists, so somebody will need to implement that as well. I like pytest, but it might not be the right tool right now as this project currently stands.
BTW is this issue really necessary now? IIRC all failed doctests have already been converted to nose tests, and other doctests work fine as-is.
@uranusjr yeah, I just forgot close this issue actually.
@eugene-eeo I don't see enough improvement if we switch to pytest. But still thanks for you introduced pytest to us. :)
I will close this issue.
as title