Page MenuHomePhabricator

Update nose to pytest on fundraising-tools
Closed, ResolvedPublic

Description

We're using nose to run our Python tests, and it was last updated in 2015. @hashar is suggesting switching to pytest, so let's move to the future and make the switch! :)

Event Timeline

Edgars2007 renamed this task from Update nose to pytools on fundraising-tools to Update nose to pytest on fundraising-tools .Jul 11 2025, 3:27 PM
AKanji-WMF moved this task from Triage to Later on the Fundraising-Backlog board.

nose is obsolete indeed and I mentioned it cause I found it at:

test-requirements.txt
nose

And that is the command being invoked:

tox.ini
commands = nosetests -v {posargs} {toxinidir}

Then in af3543274947e058f3ba696e9db51a920332076b you went to add https://pypi.org/project/pynose / https://github.com/mdmintz/pynose

requirements.txt
pynose

pynose should probably moved to test-requirements and nose be removed. Then I guess you can check whether pytest is worth adopting (I think you should, it has a lot more features).

Change #1173942 had a related patch set uploaded (by Hashar; author: Hashar):

[wikimedia/fundraising/tools@master] Remove nose, move pynose to test-requirements.txt

https://gerrit.wikimedia.org/r/1173942

Change #1173945 had a related patch set uploaded (by Hashar; author: Hashar):

[wikimedia/fundraising/tools@master] tests: remove "mock" requirement

https://gerrit.wikimedia.org/r/1173945

At a quick glance there are some assertions using nose.tools.assert_equals they can be replaced by Python built-in assert, pytest would handle them and craft a nice report.

With pytest, I don't think you need to set maxDiff anymore:

# weird thing we have to do to get better assert_equals feedback
nose.tools.assert_equals.__self__.maxDiff = None

And instead run pytest with verbose mode to have the max diff (pytest -vv).

Change #1173942 merged by jenkins-bot:

[wikimedia/fundraising/tools@master] tests: remove nose, move pynose to test-requirements.txt

https://gerrit.wikimedia.org/r/1173942

Change #1173945 merged by jenkins-bot:

[wikimedia/fundraising/tools@master] tests: remove "mock" requirement

https://gerrit.wikimedia.org/r/1173945

Change #1175485 had a related patch set uploaded (by Hashar; author: Hashar):

[wikimedia/fundraising/tools@master] Migrate from nose to pytest

https://gerrit.wikimedia.org/r/1175485

Change #1175485 merged by jenkins-bot:

[wikimedia/fundraising/tools@master] Migrate from nose to pytest

https://gerrit.wikimedia.org/r/1175485

Success! Thank you for the reviews and testing @jgleeson !