erikrose/more-itertools — pull request #51 by nvie (2014-09-10 08:19:59+00:00)
Title: Switch to pytest (because nose hides problems)

Disclaimer: there is a reason, other than personal taste, for this change.

#### The problem with nose
When I was running the test suite on Python 3 (using the tox + nose setup), I was quite puzzled why the tests were passing even though [this line is present in `more.py`](https://github.com/erikrose/more-itertools/blob/master/more_itertools/more.py#L4), and `izip_longest` isn't in the `itertools` package anymore in Python 3.

After diving into it a bit more, I found that adding this line _would_ break the tests.
```
from itertools import izip_longest
print(izip_longest) # use the imported function to expose the problem
```

Strangest, the tests don't fail with an `ImportError`, but instead with an `NameError` on the `print(izip_longest)` line. Following the stack trace, nose seems to be doing some import magic which I haven't fully grasped yet.

#### Using pytest instead
This patch changes the test runner to `py.test` instead, which does not showcase said behaviour and fails for Python 3 in the expected way:
```
more_itertools/more.py:4: in
from itertools import izip_longest
E ImportError: cannot import name 'izip_longest'
```

Note that I've simply wrapped the `eq_`, `ok_`, and `assert_raises` helpers for now. If you agree with this patch, I'll make sure to rewrite all the invocations directly, replacing them by plain `assert`s, and get rid of the wrapper functions.

Also, I would love to fix the now-exposed Python 3 errors, but I'll wait until after we've decided on this pull request.

@erikrose What do you think?