Tests dir changes

This commit is contained in:
pczempiel 2021-08-17 14:25:45 +02:00
parent 25d80441f3
commit a9cc16887c
753 changed files with 209 additions and 53 deletions

47
scripts/run_tests.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
# this script will run tavern test versus hived instance at given address
# specified in command line args.
# you should be in tavern_run location: cd tests_api/hived/tavern_run/
# basic call is: ./run_tests.sh url
# example: ./run_tests.sh https://api.hive.blog
# additionaly one can pass parameters to underlying pytest framework
# example: ./run_tests.sh https://api.hive.blog -m failing
# above will run only tests marked as failing
# you can also specify tests from given directory or file:
# example: ./run_tests.sh http://localhost:8080 account_history_api_patterns/
# example: ./run_tests.sh http://localhost:8080 account_history_api_patterns/get_transaction.tavern.yaml
function display_usage {
echo "Usage: $0 hived_url [test options]"
}
if [ $# -lt 1 ]
then
display_usage
exit 1
fi
if [[ ( $# == "--help") || $# == "-h" ]]
then
display_usage
exit 0
fi
set -e
pip3 install tox --user
export HIVEMIND_URL=$1
if [ -z "$TAVERN_DIR" ]
then
export TAVERN_DIR="hive/tests/api_tests/tavern"
fi
echo "Attempting to start tests on hived instance listening on: $HIVEMIND_URL"
echo "Additional test options: ${@:2}"
tox -- -W ignore::pytest.PytestDeprecationWarning --workers auto --tests-per-worker auto -p no:logging ${@:2}

50
scripts/run_two_nodes_tests.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
# this script will run and compare tavern test versus hived instance at given addressess
# specified in command line args.
# you should be in tavern_run location: cd tests_api/hived/tavern_run/
# basic call is: ./run_two_nodes_tests.sh url1 url2 nodes_comparison/
# example: ./run_two_nodes_tests.sh https://api.hive.blog http://localhost:8080 nodes_comparison/
# additionaly one can pass parameters to underlying pytest framework
# example: ./run_two_nodes_tests.sh https://api.hive.blog nodes_comparison -m failing
# above will run only tests marked as failing
# you can also specify tests from given directory or file:
# example: ./run_two_nodes_tests.sh http://localhost:8080 https://api.hive.blog nodes_comparison/
# example: ./run_two_nodes_tests.sh http://localhost:8080 https://api.hive.blog nodes_comparison/test_two_nodes_account_create_operation.yaml
function display_usage {
echo "Usage: $0 hived_url [test options]"
}
if [ $# -lt 1 ]
then
display_usage
exit 1
fi
if [[ ( $# == "--help") || $# == "-h" ]]
then
display_usage
exit 0
fi
set -e
pip3 install tox --user
export FIRST_HIVEMIND_URL=$1
echo "Attempting to start tests on hived instance listening on: $FIRST_HIVEMIND_URL"
export SECOND_HIVEMIND_URL=$2
if [ -z "$TAVERN_DIR" ]
then
export TAVERN_DIR="../tavern/"
fi
echo "Attempting to start tests on hived instance listening on: $SECOND_HIVEMIND_URL"
echo "Additional test options: ${@:3}"
tox -- -W ignore::pytest.PytestDeprecationWarning -n auto --durations=0 -v -p no:logging ${@:3}

95
setup.py Normal file
View File

@ -0,0 +1,95 @@
# coding=utf-8
import sys
import os
from setuptools import find_packages
from setuptools import setup
assert sys.version_info[0] == 3 and sys.version_info[1] >= 6, "hive requires Python 3.6 or newer"
VERSION = '0.0.1'
class GitRevisionProvider(object):
""" Static class to provide version and git revision information"""
@staticmethod
def provide_git_revision():
""" Evaluate version and git revision and save it to a version file
Evaluation is based on VERSION variable and git describe if
.git directory is present in tree.
In case when .git is not available version and git_revision is taken
from get_distribution call
"""
if os.path.exists("./../../.git"):
from subprocess import check_output
command = 'git -C ./../../../ describe --tags --long --dirty'
version = check_output(command.split()).decode('utf-8').strip()
parts = version.split('-')
if parts[-1] == 'dirty':
sha = parts[-2]
else:
sha = parts[-1]
git_revision = sha.lstrip('g')
GitRevisionProvider._save_version_file(VERSION, git_revision)
return git_revision
else:
from pkg_resources import get_distribution
try:
version, git_revision = get_distribution("hive").version.split("+")
GitRevisionProvider._save_version_file(version, git_revision)
return git_revision
except:
GitRevisionProvider._save_version_file(VERSION, "")
return ""
@staticmethod
def _save_version_file(hive_version, git_revision):
""" Helper method to save version.py with current version and git_revision """
with open("version.py", 'w') as version_file:
version_file.write("# generated by setup.py\n")
version_file.write("# contents will be overwritten\n")
version_file.write("VERSION = '{}'\n".format(hive_version))
version_file.write("GIT_REVISION = '{}'".format(git_revision))
GIT_REVISION = GitRevisionProvider.provide_git_revision()
if __name__ == "__main__":
setup(
name='hive',
version=VERSION + "+" + GIT_REVISION,
description='Hive - Decentralizing the exchange of ideas and information',
long_description= 'Hive is a Graphene based, social blockchain that was created as a fork of Steem and born on the core idea of decentralization.',
packages=find_packages(exclude=['scripts']),
setup_requires=[
'pytest-runner',
],
dependency_links=[
'https://github.com/bcb/jsonrpcserver/tarball/8f3437a19b6d1a8f600ee2c9b112116c85f17827#egg=jsonrpcserver-4.1.3+8f3437a'
],
install_requires=[
'aiopg @ https://github.com/aio-libs/aiopg/tarball/862fff97e4ae465333451a4af2a838bfaa3dd0bc',
'jsonrpcserver @ https://github.com/bcb/jsonrpcserver/tarball/8f3437a19b6d1a8f600ee2c9b112116c85f17827#egg=jsonrpcserver',
'simplejson',
'aiohttp',
'certifi',
'sqlalchemy',
'funcy',
'toolz',
'maya',
'ujson',
'urllib3',
'psycopg2-binary',
'aiocache',
'configargparse',
'pdoc',
'diff-match-patch',
'prometheus-client',
'psutil'
],
entry_points={
'console_scripts': [
'hive=hive.cli:run',
]
}
)

Some files were not shown because too many files have changed in this diff Show More