mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
Merge branch 'circle-ci' into 46-docstrings
This commit is contained in:
71
.circleci/config.yml
Normal file
71
.circleci/config.yml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# Python CircleCI 2.0 configuration file
|
||||||
|
#
|
||||||
|
# Check https://circleci.com/docs/2.0/language-python/ for more details
|
||||||
|
#
|
||||||
|
version: 2
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
docker:
|
||||||
|
# specify the version you desire here
|
||||||
|
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
|
||||||
|
- image: circleci/python:3.6.1
|
||||||
|
|
||||||
|
# Specify service dependencies here if necessary
|
||||||
|
# CircleCI maintains a library of pre-built images
|
||||||
|
# documented at https://circleci.com/docs/2.0/circleci-images/
|
||||||
|
# - image: circleci/postgres:9.4
|
||||||
|
|
||||||
|
working_directory: ~/repo
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
|
||||||
|
# Download and cache dependencies
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- v1-dependencies-{{ checksum "pisa/requirements.txt" }}
|
||||||
|
# fallback to using the latest cache if no exact match is found
|
||||||
|
- v1-dependencies-
|
||||||
|
|
||||||
|
- run:
|
||||||
|
name: install dependencies
|
||||||
|
command: |
|
||||||
|
python3 -m venv venv
|
||||||
|
. venv/bin/activate
|
||||||
|
pip install -r pisa/requirements.txt
|
||||||
|
|
||||||
|
- save_cache:
|
||||||
|
paths:
|
||||||
|
- ./venv
|
||||||
|
key: v1-dependencies-{{ checksum "pisa/requirements.txt" }}
|
||||||
|
|
||||||
|
# run tests!
|
||||||
|
# this example uses Django's built-in test-runner
|
||||||
|
# other common Python testing frameworks include pytest and nose
|
||||||
|
# https://pytest.org
|
||||||
|
# https://nose.readthedocs.io
|
||||||
|
- run:
|
||||||
|
name: create config
|
||||||
|
command: cp pisa/sample_conf.py pisa/conf.py
|
||||||
|
|
||||||
|
- run:
|
||||||
|
name: run pisa unit tests
|
||||||
|
command: |
|
||||||
|
. venv/bin/activate
|
||||||
|
pytest test/pisa/unit/
|
||||||
|
|
||||||
|
- run:
|
||||||
|
name: run common unit tests
|
||||||
|
command: |
|
||||||
|
. venv/bin/activate
|
||||||
|
pytest test/common/unit
|
||||||
|
|
||||||
|
# - run:
|
||||||
|
# name: run cli unit tests
|
||||||
|
# command: |
|
||||||
|
# . venv/bin/activate
|
||||||
|
# pytest test/apps/cli/unit
|
||||||
|
|
||||||
|
# - store_artifacts:
|
||||||
|
# path: test-reports
|
||||||
|
# destination: test-reports
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
zmq
|
zmq
|
||||||
flask
|
flask
|
||||||
cryptography
|
cryptography
|
||||||
requests
|
requests
|
||||||
|
plyvel
|
||||||
|
pytest
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
# bitcoind
|
# bitcoind
|
||||||
BTC_RPC_USER = None
|
BTC_RPC_USER = "user"
|
||||||
BTC_RPC_PASSWD = None
|
BTC_RPC_PASSWD = "passwd"
|
||||||
BTC_RPC_HOST = None
|
BTC_RPC_HOST = "localhost"
|
||||||
BTC_RPC_PORT = None
|
BTC_RPC_PORT = 18443
|
||||||
BTC_NETWORK = None
|
BTC_NETWORK = "regtest"
|
||||||
|
|
||||||
# ZMQ
|
# ZMQ
|
||||||
FEED_PROTOCOL = None
|
FEED_PROTOCOL = "tcp"
|
||||||
FEED_ADDR = None
|
FEED_ADDR = "127.0.0.1"
|
||||||
FEED_PORT = None
|
FEED_PORT = 28332
|
||||||
|
|
||||||
# PISA
|
# PISA
|
||||||
MAX_APPOINTMENTS = 100
|
MAX_APPOINTMENTS = 100
|
||||||
|
|||||||
0
test/apps/__init__.py
Normal file
0
test/apps/__init__.py
Normal file
0
test/apps/cli/__init__.py
Normal file
0
test/apps/cli/__init__.py
Normal file
0
test/apps/cli/unit/__init__.py
Normal file
0
test/apps/cli/unit/__init__.py
Normal file
7
test/apps/cli/unit/conftest.py
Normal file
7
test/apps/cli/unit/conftest.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import random
|
||||||
|
|
||||||
|
|
||||||
|
def get_random_value_hex(nbytes):
|
||||||
|
pseudo_random_value = random.getrandbits(8 * nbytes)
|
||||||
|
prv_hex = "{:x}".format(pseudo_random_value)
|
||||||
|
return prv_hex.zfill(2 * nbytes)
|
||||||
@@ -7,7 +7,7 @@ from cryptography.hazmat.primitives import hashes
|
|||||||
from cryptography.hazmat.primitives.asymmetric import ec
|
from cryptography.hazmat.primitives.asymmetric import ec
|
||||||
|
|
||||||
import apps.cli.pisa_cli as pisa_cli
|
import apps.cli.pisa_cli as pisa_cli
|
||||||
from test.unit.conftest import get_random_value_hex
|
from test.apps.cli.unit.conftest import get_random_value_hex
|
||||||
|
|
||||||
# TODO: should find a way of doing without this
|
# TODO: should find a way of doing without this
|
||||||
from apps.cli.pisa_cli import build_appointment
|
from apps.cli.pisa_cli import build_appointment
|
||||||
0
test/common/__init__.py
Normal file
0
test/common/__init__.py
Normal file
0
test/common/unit/__init__.py
Normal file
0
test/common/unit/__init__.py
Normal file
7
test/common/unit/conftest.py
Normal file
7
test/common/unit/conftest.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import random
|
||||||
|
|
||||||
|
|
||||||
|
def get_random_value_hex(nbytes):
|
||||||
|
pseudo_random_value = random.getrandbits(8 * nbytes)
|
||||||
|
prv_hex = "{:x}".format(pseudo_random_value)
|
||||||
|
return prv_hex.zfill(2 * nbytes)
|
||||||
@@ -3,7 +3,7 @@ import binascii
|
|||||||
from apps.cli.blob import Blob
|
from apps.cli.blob import Blob
|
||||||
from common.cryptographer import Cryptographer
|
from common.cryptographer import Cryptographer
|
||||||
from pisa.encrypted_blob import EncryptedBlob
|
from pisa.encrypted_blob import EncryptedBlob
|
||||||
from test.unit.conftest import get_random_value_hex
|
from test.common.unit.conftest import get_random_value_hex
|
||||||
|
|
||||||
data = "6097cdf52309b1b2124efeed36bd34f46dc1c25ad23ac86f28380f746254f777"
|
data = "6097cdf52309b1b2124efeed36bd34f46dc1c25ad23ac86f28380f746254f777"
|
||||||
key = "b2e984a570f6f49bc38ace178e09147b0aa296cbb7c92eb01412f7e2d07b5659"
|
key = "b2e984a570f6f49bc38ace178e09147b0aa296cbb7c92eb01412f7e2d07b5659"
|
||||||
0
test/pisa/__init__.py
Normal file
0
test/pisa/__init__.py
Normal file
0
test/pisa/unit/__init__.py
Normal file
0
test/pisa/unit/__init__.py
Normal file
@@ -11,7 +11,7 @@ from pisa.tools import bitcoin_cli
|
|||||||
from pisa import HOST, PORT, c_logger
|
from pisa import HOST, PORT, c_logger
|
||||||
from pisa.conf import MAX_APPOINTMENTS
|
from pisa.conf import MAX_APPOINTMENTS
|
||||||
|
|
||||||
from test.unit.conftest import (
|
from test.pisa.unit.conftest import (
|
||||||
generate_block,
|
generate_block,
|
||||||
generate_blocks,
|
generate_blocks,
|
||||||
get_random_value_hex,
|
get_random_value_hex,
|
||||||
@@ -5,7 +5,7 @@ from pisa import c_logger
|
|||||||
from pisa.appointment import Appointment
|
from pisa.appointment import Appointment
|
||||||
from pisa.encrypted_blob import EncryptedBlob
|
from pisa.encrypted_blob import EncryptedBlob
|
||||||
|
|
||||||
from test.unit.conftest import get_random_value_hex
|
from test.pisa.unit.conftest import get_random_value_hex
|
||||||
|
|
||||||
from common.constants import LOCATOR_LEN_BYTES
|
from common.constants import LOCATOR_LEN_BYTES
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@ from binascii import unhexlify
|
|||||||
|
|
||||||
from pisa import c_logger
|
from pisa import c_logger
|
||||||
from apps.cli.blob import Blob
|
from apps.cli.blob import Blob
|
||||||
from test.unit.conftest import get_random_value_hex
|
from test.pisa.unit.conftest import get_random_value_hex
|
||||||
|
|
||||||
c_logger.disabled = True
|
c_logger.disabled = True
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@ import pytest
|
|||||||
|
|
||||||
from pisa import c_logger
|
from pisa import c_logger
|
||||||
from pisa.block_processor import BlockProcessor
|
from pisa.block_processor import BlockProcessor
|
||||||
from test.unit.conftest import get_random_value_hex, generate_block, generate_blocks
|
from test.pisa.unit.conftest import get_random_value_hex, generate_block, generate_blocks
|
||||||
|
|
||||||
c_logger.disabled = True
|
c_logger.disabled = True
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from pisa.builder import Builder
|
from pisa.builder import Builder
|
||||||
from test.unit.conftest import get_random_value_hex, generate_dummy_appointment, generate_dummy_tracker
|
from test.pisa.unit.conftest import get_random_value_hex, generate_dummy_appointment, generate_dummy_tracker
|
||||||
|
|
||||||
|
|
||||||
def test_build_appointments():
|
def test_build_appointments():
|
||||||
@@ -4,7 +4,7 @@ from pisa import c_logger
|
|||||||
from pisa.carrier import Carrier
|
from pisa.carrier import Carrier
|
||||||
from test.simulator.utils import sha256d
|
from test.simulator.utils import sha256d
|
||||||
from test.simulator.transaction import TX
|
from test.simulator.transaction import TX
|
||||||
from test.unit.conftest import generate_blocks, generate_block, get_random_value_hex
|
from test.pisa.unit.conftest import generate_blocks, get_random_value_hex
|
||||||
from pisa.rpc_errors import RPC_VERIFY_ALREADY_IN_CHAIN, RPC_DESERIALIZATION_ERROR
|
from pisa.rpc_errors import RPC_VERIFY_ALREADY_IN_CHAIN, RPC_DESERIALIZATION_ERROR
|
||||||
|
|
||||||
c_logger.disabled = True
|
c_logger.disabled = True
|
||||||
@@ -7,7 +7,7 @@ from pisa.cleaner import Cleaner
|
|||||||
from pisa.appointment import Appointment
|
from pisa.appointment import Appointment
|
||||||
from pisa.db_manager import WATCHER_PREFIX
|
from pisa.db_manager import WATCHER_PREFIX
|
||||||
|
|
||||||
from test.unit.conftest import get_random_value_hex
|
from test.pisa.unit.conftest import get_random_value_hex
|
||||||
|
|
||||||
from common.constants import LOCATOR_LEN_BYTES, LOCATOR_LEN_HEX
|
from common.constants import LOCATOR_LEN_BYTES, LOCATOR_LEN_HEX
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ from pisa.db_manager import WATCHER_LAST_BLOCK_KEY, RESPONDER_LAST_BLOCK_KEY, LO
|
|||||||
|
|
||||||
from common.constants import LOCATOR_LEN_BYTES
|
from common.constants import LOCATOR_LEN_BYTES
|
||||||
|
|
||||||
from test.unit.conftest import get_random_value_hex, generate_dummy_appointment
|
from test.pisa.unit.conftest import get_random_value_hex, generate_dummy_appointment
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
from pisa import c_logger
|
from pisa import c_logger
|
||||||
from pisa.encrypted_blob import EncryptedBlob
|
from pisa.encrypted_blob import EncryptedBlob
|
||||||
from test.unit.conftest import get_random_value_hex
|
from test.pisa.unit.conftest import get_random_value_hex
|
||||||
|
|
||||||
c_logger.disabled = True
|
c_logger.disabled = True
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ from pisa.appointment import Appointment
|
|||||||
from pisa.block_processor import BlockProcessor
|
from pisa.block_processor import BlockProcessor
|
||||||
from pisa.conf import MIN_TO_SELF_DELAY
|
from pisa.conf import MIN_TO_SELF_DELAY
|
||||||
|
|
||||||
from test.unit.conftest import get_random_value_hex, generate_dummy_appointment_data, generate_keypair
|
from test.pisa.unit.conftest import get_random_value_hex, generate_dummy_appointment_data, generate_keypair
|
||||||
|
|
||||||
from common.constants import LOCATOR_LEN_BYTES, LOCATOR_LEN_HEX
|
from common.constants import LOCATOR_LEN_BYTES, LOCATOR_LEN_HEX
|
||||||
from common.cryptographer import Cryptographer
|
from common.cryptographer import Cryptographer
|
||||||
@@ -18,7 +18,7 @@ from common.tools import check_sha256_hex_format
|
|||||||
|
|
||||||
from test.simulator.utils import sha256d
|
from test.simulator.utils import sha256d
|
||||||
from test.simulator.bitcoind_sim import TX
|
from test.simulator.bitcoind_sim import TX
|
||||||
from test.unit.conftest import generate_block, generate_blocks, get_random_value_hex
|
from test.pisa.unit.conftest import generate_block, generate_blocks, get_random_value_hex
|
||||||
|
|
||||||
c_logger.disabled = True
|
c_logger.disabled = True
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ from pisa import c_logger
|
|||||||
from pisa.watcher import Watcher
|
from pisa.watcher import Watcher
|
||||||
from pisa.responder import Responder
|
from pisa.responder import Responder
|
||||||
from pisa.tools import bitcoin_cli
|
from pisa.tools import bitcoin_cli
|
||||||
from test.unit.conftest import (
|
from test.pisa.unit.conftest import (
|
||||||
generate_block,
|
generate_block,
|
||||||
generate_blocks,
|
generate_blocks,
|
||||||
generate_dummy_appointment,
|
generate_dummy_appointment,
|
||||||
@@ -4,7 +4,7 @@ from time import sleep
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
from test.simulator.transaction import TX
|
from test.simulator.transaction import TX
|
||||||
from test.unit.conftest import get_random_value_hex
|
from test.pisa.unit import get_random_value_hex
|
||||||
from test.simulator.bitcoind_sim import run_simulator
|
from test.simulator.bitcoind_sim import run_simulator
|
||||||
from pisa.utils.auth_proxy import AuthServiceProxy, JSONRPCException
|
from pisa.utils.auth_proxy import AuthServiceProxy, JSONRPCException
|
||||||
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT
|
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT
|
||||||
|
|||||||
Reference in New Issue
Block a user