1
0
mirror of https://github.com/bigchaindb/bigchaindb.git synced 2024-12-28 07:37:50 +01:00

Problem: there are no f-strings in python 3.5 (#2185)

Solution: change f-strings to a compatible format for Python 3.5
This commit is contained in:
codegeschrei 2018-04-09 17:02:59 +02:00 committed by vrde
parent d4934b9525
commit 6f69f39ff4
8 changed files with 23 additions and 5 deletions

View File

@ -6,6 +6,9 @@ pip install --upgrade pip
if [[ -n ${TOXENV} ]]; then
pip install --upgrade tox
elif [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then
docker-compose build --build-arg python_version=3.5 --no-cache bigchaindb
pip install --upgrade codecov
else
docker-compose build --no-cache bigchaindb
pip install --upgrade codecov

View File

@ -9,6 +9,7 @@ language: python
cache: pip
python:
- 3.5
- 3.6
env:
@ -21,7 +22,18 @@ env:
matrix:
fast_finish: true
exclude:
- python: 3.5
env: TOXENV=flake8
- python: 3.5
env: TOXENV=docsroot
- python: 3.5
env: TOXENV=docsserver
include:
- python: 3.5
env:
- BIGCHAINDB_DATABASE_BACKEND=localmongodb
- BIGCHAINDB_DATABASE_SSL=
- python: 3.6
env:
- BIGCHAINDB_DATABASE_BACKEND=localmongodb

View File

@ -1,4 +1,5 @@
FROM python:3.6
ARG python_version=3.6
FROM python:${python_version}
LABEL maintainer "dev@bigchaindb.com"
RUN apt-get update \

View File

@ -13,7 +13,7 @@ from bigchaindb.tendermint.utils import decode_transaction_base64
HOST = getenv('BIGCHAINDB_TENDERMINT_HOST', 'localhost')
PORT = int(getenv('BIGCHAINDB_TENDERMINT_PORT', 46657))
URL = f'ws://{HOST}:{PORT}/websocket'
URL = 'ws://{}:{}/websocket'.format(HOST, PORT)
logger = logging.getLogger(__name__)

View File

@ -162,7 +162,7 @@ class BigchainDB(Bigchain):
# See common/transactions.py for details.
hashes = [
sha3_256(
f'''{utxo['transaction_id']}{utxo['output_index']}'''.encode()
'{}{}'.format(utxo['transaction_id'], utxo['output_index']).encode()
).digest() for utxo in utxoset
]
# TODO Notice the sorted call!
@ -333,7 +333,7 @@ class BigchainDB(Bigchain):
def get_validators(self):
try:
resp = requests.get(f'{ENDPOINT}validators')
resp = requests.get('{}validators'.format(ENDPOINT))
validators = resp.json()['result']['validators']
for v in validators:
v.pop('accum')

View File

@ -117,6 +117,7 @@ setup(
'Natural Language :: English',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',

View File

@ -529,7 +529,7 @@ def tendermint_port():
@pytest.fixture
def tendermint_ws_url(tendermint_host, tendermint_port):
return f'ws://{tendermint_host}:{tendermint_port}/websocket'
return 'ws://{}:{}/websocket'.format(tendermint_host, tendermint_port)
@pytest.fixture

View File

@ -68,6 +68,7 @@ def test_process_unknown_event():
assert event_queue.empty()
@pytest.mark.skip('This test will be an integration test.')
@pytest.mark.asyncio
async def test_subscribe_events(tendermint_ws_url):
from bigchaindb.tendermint.event_stream import subscribe_events