monero-ecosystem / monero-python

A comprehensive Python module for handling Monero cryptocurrency
BSD 3-Clause "New" or "Revised" License
245 stars 79 forks source link

continuous integration goodies #26

Closed rooterkyberian closed 6 years ago

rooterkyberian commented 6 years ago

Please note you most likely don't want to merge this before https://github.com/emesik/monero-python/pull/25 .

https://travis-ci.org/rooterkyberian/monero-python/branches https://coveralls.io/github/rooterkyberian/monero-python

emesik commented 6 years ago

Hmm, I'm not familiar with CI at all, but now this PR seems to break tests:

$ python setup.py test
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'pytest'

I have pytest installed. It also signals an error when run in the project dir:

$ pytest
usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --cov=monero
  inifile: /home/emes/devel/monero-python/setup.cfg
  rootdir: /home/emes/devel/monero-python
rooterkyberian commented 6 years ago

I should have both included some instructions in the readme (this is fixed now) from the beginning and description in the pull request explaining what have been done.

So this ticket introduces configuration for Travis CI, which uses pytest runner and Coveralls for showing both if tests are passing and the test coverage. To enable it you will need to log in with github to both Travis CI http://travis-ci.org/ and Coveralls https://coveralls.io/ and active them for this project. After that and merging this PR tests will automatically start running for every new change commited and every new PR created - which makes reviewing contributions significantly easier. This services are de facto standard (and of course free) for open source projects hosted on github.

Now as to why replaced standard python unittest test runner with pytest. pytest is a very popular test runner for which you will have an easy time to find advantages over unittest module, and in this case, it was just that much easier to integrate test coverage analysis using it.

emesik commented 6 years ago

Sounds great, but still running pytest fails with unrecognized arguments: --cov=monero.

Got the same result in Python 2.7.15 and 3.6.5

rooterkyberian commented 6 years ago

and you are sure you have run pip install -r requirements.txt -r test_requirements.txt ?

I had some syntax still messed up in readme, now it should properly render: https://github.com/rooterkyberian/monero-python/blob/ci/README.rst