continuous integration goodies from rooterkyberian (#26)

* continuous integration goodies

* fixed test_address not running

* fixup `python setup.py test`

* fixup readme.rst formatting
This commit is contained in:
Maciej "RooTer" Urbański 2018-06-12 13:09:35 +02:00 committed by Michał Sałaban
parent 7176f3fa0f
commit 12e69da496
8 changed files with 107 additions and 1 deletions

15
.editorconfig Normal file
View File

@ -0,0 +1,15 @@
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
charset = utf-8
max_line_length = 120
[*.yml]
indent_size = 2

19
.travis.yml Normal file
View File

@ -0,0 +1,19 @@
language: python
python:
- "2.7"
- "3.6"
- "nightly"
matrix:
allow_failures:
python: "nightly"
cache: pip
before_install:
- pip install -r test_requirements.txt
install:
- pip install -e . # install dependencies as specified in setup.py
script:
- pytest
after_success:
- coveralls

View File

@ -1,6 +1,17 @@
Python Monero module
====================
|travis|_ |coveralls|_
.. |travis| image:: https://travis-ci.org/emesik/monero-python.svg
.. _travis: https://travis-ci.org/emesik/monero-python
.. |coveralls| image:: https://coveralls.io/repos/github/emesik/monero-python/badge.svg
.. _coveralls: https://coveralls.io/github/emesik/monero-python
A comprehensive Python module for handling Monero cryptocurrency.
* release 0.3
@ -40,3 +51,29 @@ Want to help?
If you find this project useful, please consider a donation to the following address:
``481SgRxo8hwBCY4z6r88JrN5X8JFCJYuJUDuJXGybTwaVKyoJPKoGj3hQRAEGgQTdmV1xH1URdnHkJv6He5WkEbq6iKhr94``
Development
-----------
1. Clone the repo
2. Create virtualenv & activate it
.. code-block:: bash
python3.6 -m venv .venv
source .venv/bin/activate
3. Install dependencies
.. code-block:: bash
pip install -r requirements.txt -r test_requirements.txt
4. Do your thing
5. Run tests
.. code-block:: bash
pytest

6
setup.cfg Executable file
View File

@ -0,0 +1,6 @@
[aliases]
test=pytest
[tool:pytest]
rootdir=tests
addopts=--cov=monero

View File

@ -32,6 +32,10 @@ setup(
url = 'https://github.com/emesik/monero-python/',
long_description = open('README.rst', 'rb').read().decode('utf-8'),
install_requires = open('requirements.txt', 'r').read().splitlines(),
tests_requires=open('test_requirements.txt', 'r').read().splitlines(),
setup_requires=[
'pytest-runner',
],
packages = find_packages('.', exclude=['tests']),
include_package_data = True,
author = 'Michał Sałaban',

6
test_requirements.txt Normal file
View File

@ -0,0 +1,6 @@
coverage~=4.5.1
coveralls
pip>=9
pytest-cov~=2.5
pytest-runner~=4.2
pytest~=3.6

View File

@ -1,8 +1,14 @@
import unittest
from monero.address import Address, SubAddress, IntegratedAddress, address
from tests.utils import classproperty
class Tests(object):
@classproperty
def __test__(cls):
return issubclass(cls, unittest.TestCase)
def test_from_and_to_string(self):
a = Address(self.addr)
self.assertEqual(str(a), self.addr)
@ -112,7 +118,6 @@ class Tests(object):
address,
'Cf6RinMUztY5otm6NEFjg3UWBBkXK6Lh23wKrLFMEcCY7i3A6aPLH9i4QMCkf6CdWk8Q9N7yoJf7ANKgtQMuPM6JANXgCWs')
def test_type_mismatch(self):
self.assertRaises(ValueError, Address, self.iaddr)
self.assertRaises(ValueError, Address, self.subaddr)

14
tests/utils.py Normal file
View File

@ -0,0 +1,14 @@
class ClassPropertyDescriptor(object):
"""Based on https://stackoverflow.com/questions/5189699/how-to-make-a-class-property"""
def __init__(self, fget):
self.fget = fget
def __get__(self, obj, klass):
if klass is None:
klass = type(obj)
return self.fget.__get__(obj, klass)()
def classproperty(func):
return ClassPropertyDescriptor(classmethod(func))