Skip to content
This repository was archived by the owner on Mar 9, 2024. It is now read-only.

Commit 12e69da

Browse files
rooterkyberianemesik
authored andcommitted
continuous integration goodies from rooterkyberian (#26)
* continuous integration goodies * fixed test_address not running * fixup `python setup.py test` * fixup readme.rst formatting
1 parent 7176f3f commit 12e69da

8 files changed

+107
-1
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 4
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
end_of_line = lf
11+
charset = utf-8
12+
max_line_length = 120
13+
14+
[*.yml]
15+
indent_size = 2

.travis.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: python
2+
python:
3+
- "2.7"
4+
- "3.6"
5+
- "nightly"
6+
7+
matrix:
8+
allow_failures:
9+
python: "nightly"
10+
11+
cache: pip
12+
before_install:
13+
- pip install -r test_requirements.txt
14+
install:
15+
- pip install -e . # install dependencies as specified in setup.py
16+
script:
17+
- pytest
18+
after_success:
19+
- coveralls

README.rst

+37
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Python Monero module
22
====================
33

4+
|travis|_ |coveralls|_
5+
6+
7+
.. |travis| image:: https://travis-ci.org/emesik/monero-python.svg
8+
.. _travis: https://travis-ci.org/emesik/monero-python
9+
10+
11+
.. |coveralls| image:: https://coveralls.io/repos/github/emesik/monero-python/badge.svg
12+
.. _coveralls: https://coveralls.io/github/emesik/monero-python
13+
14+
415
A comprehensive Python module for handling Monero cryptocurrency.
516

617
* release 0.3
@@ -40,3 +51,29 @@ Want to help?
4051

4152
If you find this project useful, please consider a donation to the following address:
4253
``481SgRxo8hwBCY4z6r88JrN5X8JFCJYuJUDuJXGybTwaVKyoJPKoGj3hQRAEGgQTdmV1xH1URdnHkJv6He5WkEbq6iKhr94``
54+
55+
56+
Development
57+
-----------
58+
59+
1. Clone the repo
60+
2. Create virtualenv & activate it
61+
62+
.. code-block:: bash
63+
64+
python3.6 -m venv .venv
65+
source .venv/bin/activate
66+
67+
3. Install dependencies
68+
69+
.. code-block:: bash
70+
71+
pip install -r requirements.txt -r test_requirements.txt
72+
73+
4. Do your thing
74+
75+
5. Run tests
76+
77+
.. code-block:: bash
78+
79+
pytest

setup.cfg

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[aliases]
2+
test=pytest
3+
4+
[tool:pytest]
5+
rootdir=tests
6+
addopts=--cov=monero

setup.py

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ def find_version(*parts):
3232
url = 'https://github.com/emesik/monero-python/',
3333
long_description = open('README.rst', 'rb').read().decode('utf-8'),
3434
install_requires = open('requirements.txt', 'r').read().splitlines(),
35+
tests_requires=open('test_requirements.txt', 'r').read().splitlines(),
36+
setup_requires=[
37+
'pytest-runner',
38+
],
3539
packages = find_packages('.', exclude=['tests']),
3640
include_package_data = True,
3741
author = 'Michał Sałaban',

test_requirements.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
coverage~=4.5.1
2+
coveralls
3+
pip>=9
4+
pytest-cov~=2.5
5+
pytest-runner~=4.2
6+
pytest~=3.6

tests/test_address.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import unittest
22

33
from monero.address import Address, SubAddress, IntegratedAddress, address
4+
from tests.utils import classproperty
5+
46

57
class Tests(object):
8+
@classproperty
9+
def __test__(cls):
10+
return issubclass(cls, unittest.TestCase)
11+
612
def test_from_and_to_string(self):
713
a = Address(self.addr)
814
self.assertEqual(str(a), self.addr)
@@ -112,7 +118,6 @@ def test_invalid(self):
112118
address,
113119
'Cf6RinMUztY5otm6NEFjg3UWBBkXK6Lh23wKrLFMEcCY7i3A6aPLH9i4QMCkf6CdWk8Q9N7yoJf7ANKgtQMuPM6JANXgCWs')
114120

115-
116121
def test_type_mismatch(self):
117122
self.assertRaises(ValueError, Address, self.iaddr)
118123
self.assertRaises(ValueError, Address, self.subaddr)

tests/utils.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class ClassPropertyDescriptor(object):
2+
"""Based on https://stackoverflow.com/questions/5189699/how-to-make-a-class-property"""
3+
4+
def __init__(self, fget):
5+
self.fget = fget
6+
7+
def __get__(self, obj, klass):
8+
if klass is None:
9+
klass = type(obj)
10+
return self.fget.__get__(obj, klass)()
11+
12+
13+
def classproperty(func):
14+
return ClassPropertyDescriptor(classmethod(func))

0 commit comments

Comments
 (0)