Browse Source
masterc4d9b9264atests: make setup fixtures optional. (PulpCattel) Pull request description: Currently, in tests, we always setup `bitcoind` and `miniircd` (this happens because of `autouse=True` in fixtures). A lot of test modules do not require these slow and expensive setups. (`miniircd` in particular is AFAICT only used in 1 test module `jmdaemon/test/test_irc_messaging.py`). After #1427, we now have indipendent fixtures for each component, so we can tell `Pytest` specifically what we need. This PR uses [pytest.mark.usefixtures()](https://docs.pytest.org/en/7.2.x/how-to/fixtures.html#use-fixtures-in-classes-and-modules-with-usefixtures) to specify fixtures usage at the test module level. Useful so that fixtures like `setup_regtest_bitcoind` can run *only* if we are planning to invoke a test that requires them. For example, it's now possible to run: ``` pytest jmbitcoin/ ``` This will skip all setup initialization because no test module in `/jmbitcoin` asks for it. When running the entire test suite, there should be no difference in behaviour. To see "behind the scene” of how `Pytest` schedules a test run, without actually running it, there's the very useful option `--setup-plan`. ACKs for top commit: AdamISZ: Nice change, thanks. tACKc4d9b9264aTree-SHA512: 307d8a60a13cbbd9648efc489cb6da2ecf8e3d42772df09ec99a14fa822ad86ca53212364fd437c79ab718a8effe0de6b6810f6a8ee1df3ae1ad44181beec7a3
27 changed files with 98 additions and 1 deletions
Loading…
Reference in new issue