tests: port from nosetests to pytest
Nosetests is not actively developed anymore. Pytest is actively developed and has a much larger ecosystem around it. Two features of pytest are particularly helpful for us: Pytest captures stdio by redirecting at the file descriptor-level instead of replacing sys.stdout. This is required for Mercurial, as it has its own reference to stdout. Before with nosetests, most output was silently swallowed. Pytest offers the `ALLOW_UNICODE` and `ALLOW_BYTES` options for doctests, making it much easier to make our docstrings Python 2- and Python 3-compatiable. During this patch, it was attempted to leave the structure of the test code similar to before instead of converting everything to idiomatic pytest code. Luckily, pytest implements enough interoperability for most of our test code.
Showing with 145 additions and 127 deletions