PyNN icon indicating copy to clipboard operation
PyNN copied to clipboard

Testing: move away from deprecated Nose

Open sanjayankur31 opened this issue 4 years ago • 3 comments

Hello,

Filing this since it came up during the Fedora review. The ci script still use nosetests, but nose is deprecated---the last commit was in 2016.

https://github.com/nose-devs/nose/commits/master

https://github.com/NeuralEnsemble/PyNN/blob/master/ci/test_script.sh

The website says:

https://nose.readthedocs.io/en/latest/

"Nose has been in maintenance mode for the past several years and will likely cease without a new person/team to take over maintainership. New projects should consider using Nose2, py.test, or just plain unittest/unittest2."

So we should look to move away from nose to another test framework. Perhaps py.test, which seems to be a good one.

  • Fedora review of the PyNN package: https://bugzilla.redhat.com/show_bug.cgi?id=1150105
  • Deprecation of nose in Fedora: https://fedoraproject.org/wiki/Changes/DeprecateNose

sanjayankur31 avatar Jan 12 '21 11:01 sanjayankur31

Let me know if you need help with this. I agree that py.test is the most common choice nowadays. We have made the transition from nose to py.test in the Brian simulator a while ago and I really like some features of py.test like the parametrized tests.

mstimberg avatar Jan 12 '21 11:01 mstimberg

Let me know if you need help with this

The answer is always, "yes please!" 😁 (although in fact @mstimberg if you do have a couple of hours to spend improving PyNN, I would really appreciate your review of the new Brian 2 backend)

@sanjayankur31 I'd be happy to move to py.test. That's what I've been using for all my newer projects. The only "advanced" feature of nose we use is test generators which allow use of the same test function for different backends.

apdavison avatar Jan 12 '21 13:01 apdavison

I had a quick look, and it seems that the way to use test generators in pytest is to parameterize them:

https://docs.pytest.org/en/stable/parametrize.html

I also found https://github.com/pytest-dev/nose2pytest.

I don't see enough free-time to work on this for the next month, but if I do find the time, I'll open a PR :)

sanjayankur31 avatar Feb 09 '21 10:02 sanjayankur31

Implemented in #761

apdavison avatar Jan 31 '23 14:01 apdavison