-
-
Notifications
You must be signed in to change notification settings - Fork 746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch test runner from nosetest to pytest #6291
Conversation
Lockfile diff: lockfiles/st2.lock [st2] == Upgraded dependencies == amqp 5.2.0 --> 5.3.1 apscheduler 3.10.4 --> 3.11.0 argcomplete 3.5.1 --> 3.5.2 async-timeout 4.0.3 --> 5.0.1 attrs 24.2.0 --> 24.3.0 bcrypt 4.2.0 --> 4.2.1 certifi 2024.8.30 --> 2024.12.14 ciso8601 2.3.1 --> 2.3.2 eventlet 0.37.0 --> 0.38.2 orjson 3.10.10 --> 3.10.12 packaging 24.1 --> 24.2 pip 24.2 --> 24.3.1 pyspnego 0.11.1 --> 0.11.2 python-json-logger 2.0.7 --> 3.2.1 redis 5.2.0 --> 5.2.1 setuptools 75.2.0 --> 75.3.0 six 1.16.0 --> 1.17.0 tomli 2.0.2 --> 2.2.1 virtualenv 20.27.0 --> 20.28.0 werkzeug 3.0.4 --> 3.0.6 wheel 0.44.0 --> 0.45.1 wrapt 1.16.0 --> 1.17.0 == Removed dependencies == colorama 0.4.6 nose 1.3.7 nose-parallel 0.4.0 nose-timer 1.0.1 rednose 1.3.0 termstyle 0.1.11
only for Makefile-based pytest runs
This is important for the directories where we don't yet have tests. This is only relevant for when the Makefile runs pytest, because pants only runs pytest on files that exist, but the Makefile blindly tries to run on every component directory.
Well that's disappointing. I added Oddly enough For the 2 failures, the AttributeError happens in only those 2 tests. The rest of the tests in that file (and in the same unittest class) all pass in both shards even though many of them use the same model and the same attribute. What could cause this behavior?! |
This way each file's tests will run together.
I inlined the pytest-test-group plugin and modified it to shard the files instead of the tests, which is basically what pants does. So, now we aren't getting those weird failures when tests in the same file get run in different shards/chunks. |
This cherry-picks commits from #6236 from @nzlosh, @FileMagic, and @guzzijones.
This adjust the
Makefile
andst2-run-pack-tests
to usepytest
instead ofnosetest
. We need to switch becausenosetest
is unmaintained and does not support python 3.10. Goodbyenosetest
! 🎉Several of the tests were adjusted to:
pytest.raises
instead ofassertRaisesRegex
, andpytest.mark.skipif
instead ofunittest.skipIf
.Finally, this drops
nose
(and plugins) from requirements and regenerateslockfiles/st2.lock
. I also copied the updated requirement pins from the lockfile intofixed-requirements.txt
and related files.A follow-up PR will cherry-pick changes to finally start testing with python 3.10 +.