wasmtime-py icon indicating copy to clipboard operation
wasmtime-py copied to clipboard

use pytest or not use pytest?

Open willkg opened this issue 5 years ago • 4 comments

In the README it suggests to use pytest for test discovery. pytest has a bunch of other features, but some of those features don't work when test classes subclass unittest.TestCase.

If wasmtime-py wanted to use pytest, then I would throw together a PR that makes the following changes:

  1. remove instances of subclassing unittest.TestCase
  2. switch from unittest assert methods to assert x == y statements
  3. switch to pytest.raises

If wasmtime-py wanted to use unittest, I could throw together a PR that fixes setup.py so that python setup.py test works.

Any preference?

willkg avatar May 22 '20 19:05 willkg

I don't personally mind going either way myself, I was mostly just getting confused when I set this up originally. So long as it's easy to write tests and it's easy to run tests I don't think it matters too much what the specifics are!

alexcrichton avatar May 22 '20 20:05 alexcrichton

fixes setup.py so that python setup.py test works.

That's deprecated.

whitequark avatar May 22 '20 20:05 whitequark

fixes setup.py so that python setup.py test works.

That's deprecated.

Oh neat! I didn't know that. It was always a pain in the ass to support.

pytest has some niceties around what gets displayed in test failures when using regular asserts. Otherwise it seems like six-of-one vs. half-dozen-of-the-other with this test suite.

willkg avatar May 22 '20 20:05 willkg

Hi Alex (and Will). As I promised in my email a few days ago I've just submitted a PR... so hopefully I'm more welcome to chime in here as a random bloke in Seattle than I was before.

I'm a big fan of pytest over unittest.

pytest gives you lots of information when tests fail, because of all its magical cleverness.

tobych avatar May 24 '20 05:05 tobych