Init pypy support

This commit is contained in:
Nikita Chernyi 2019-07-01 13:44:35 +03:00
parent c801c833fc
commit c6c6deb71f
No known key found for this signature in database
GPG Key ID: 59AAF447DE36F9A4
7 changed files with 25 additions and 9 deletions

View File

@ -1,5 +1,5 @@
ARG python_version=3.6
FROM python:${python_version}
FROM pypy:${python_version}
LABEL maintainer "devs@bigchaindb.com"
RUN apt-get update \
@ -33,4 +33,4 @@ RUN mkdir -p /usr/src/app
COPY . /usr/src/app/
WORKDIR /usr/src/app
RUN pip install -e .[dev]
RUN bigchaindb -y configure
RUN bigchaindb -y configure

View File

@ -5,7 +5,11 @@
# Separate all crypto code so that we can easily test several implementations
from collections import namedtuple
import sha3
try:
from hashlib import sha3_256
except ImportError:
from sha3 import sha3_256
from cryptoconditions import crypto
@ -14,7 +18,7 @@ CryptoKeypair = namedtuple('CryptoKeypair', ('private_key', 'public_key'))
def hash_data(data):
"""Hash the provided data using SHA3-256"""
return sha3.sha3_256(data.encode()).hexdigest()
return sha3_256(data.encode()).hexdigest()
def generate_key_pair():

View File

@ -19,7 +19,10 @@ import base58
from cryptoconditions import Fulfillment, ThresholdSha256, Ed25519Sha256
from cryptoconditions.exceptions import (
ParsingError, ASN1DecodeError, ASN1EncodeError, UnsupportedTypeError)
from sha3 import sha3_256
try:
from hashlib import sha3_256
except ImportError:
from sha3 import sha3_256
from bigchaindb.common.crypto import PrivateKey, hash_data
from bigchaindb.common.exceptions import (KeypairMismatchException,

View File

@ -74,7 +74,7 @@ tests_require = [
install_requires = [
# TODO Consider not installing the db drivers, or putting them in extras.
'pymongo~=3.6',
'pysha3~=1.0.2',
# 'pysha3~=1.0.2', # @PYPY: not compability with PyPy, replaced with native hashlib
'cryptoconditions==0.8.0',
'python-rapidjson~=0.6.0',
'logstats~=0.2.1',

View File

@ -11,7 +11,10 @@ from copy import deepcopy
from base58 import b58encode, b58decode
from cryptoconditions import Ed25519Sha256
from pytest import mark, raises
from sha3 import sha3_256
try:
from hashlib import sha3_256
except ImportError:
from sha3 import sha3_256
pytestmark = mark.bdb

View File

@ -9,7 +9,10 @@ structural / schematic issues are caught when reading a transaction
import json
import pytest
import sha3
try:
import hashlib as sha3
except ImportError:
import sha3
from unittest.mock import MagicMock
from bigchaindb.common.exceptions import (AmountError,

View File

@ -8,7 +8,10 @@ from unittest.mock import Mock, patch
import base58
import pytest
from cryptoconditions import Ed25519Sha256
from sha3 import sha3_256
try:
from hashlib import sha3_256
except ImportError:
from sha3 import sha3_256
from bigchaindb.common import crypto
from bigchaindb.common.transaction_mode_types import (BROADCAST_TX_COMMIT,