How do I run the test suites? I have a working copy of (github source code of) Electrum and would like to run the tests. It would be good to have documentation how this is done.
I agree, some contribution guidelines would be great. I'll try to collect my notes somewhere.
You should be able to run the bulk of the tests by something like:
git clone https://github.com/spesmilo/electrum
cd electrum
python3 -m venv venv
source venv/bin/activate
python3 -m pip install -e .
python3 -m pip install pycryptodomex
sudo apt install libsecp256k1-0
python3 -m unittest discover
There may be some tests with other dependencies that fail.
You can also find more about testing in https://github.com/spesmilo/electrum/blob/master/.travis.yml .
You can do this if it's a unit test.
~/electrum$ pytest electrum/tests -v
============================================================================= test session starts =============================================================================
platform linux -- Python 3.6.9, pytest-4.6.3, py-1.8.0, pluggy-0.12.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/wakiyamap/electrum
collected 491 items
electrum/tests/test_bitcoin.py::Test_bitcoin::test_add_number_to_script PASSED [ 0%]
electrum/tests/test_bitcoin.py::Test_bitcoin::test_address_to_script PASSED [ 0%]
.........
and......
~/electrum$ pytest electrum/tests/test_bitcoin.py::Test_bitcoin::test_add_number_to_script
============================================================================= test session starts =============================================================================
platform linux -- Python 3.6.9, pytest-4.6.3, py-1.8.0, pluggy-0.12.0
rootdir: /home/wakiyamap/electrum
collected 1 item
electrum/tests/test_bitcoin.py . [100%]
========================================================================== 1 passed in 0.57 seconds ===========================================================================
For myself when running the test, I get a failure about KIVY. It does tell me where I can go download it but you might want to add that to the instructions for running unit-tests anyway.