Extrapolate more testing steps for CI workflows; Skip publication steps (preversion).

pull/562/head
Kieran Prasch 2018-11-23 21:13:11 -08:00
parent 3806fe68f7
commit b2669b8edf
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
5 changed files with 111 additions and 82 deletions

View File

@ -12,6 +12,10 @@ workflows:
filters:
tags:
only: /.*/
- mypy:
filters:
tags:
only: /.*/
- contracts:
context: "NuCypher Tests"
filters:
@ -60,39 +64,35 @@ workflows:
- pip_install
- pipenv_install
- blockchain_entities:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- pip_install
- pipenv_install
- character:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- pip_install
- pipenv_install
- intercontract_integration:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- contracts
- mypy:
- agents:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- config
- crypto
- network
- keystore
- character
- cli_tests:
- blockchain_interface
- actors:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- blockchain_interface
- deployers:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- intercontract_integration
- blockchain_interface
- config:
context: "NuCypher Tests"
filters:
tags:
@ -104,48 +104,65 @@ workflows:
- network
- keystore
- character
- ursula_command_tests:
- cli:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- learning
- cli:
- actors
- deployers
- config
- character
- ursula_command:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- ursula_command
- intercontract_integration
- mypy
- test_deploy:
context: "NuCypher PyPI"
requires:
- test_build
filters:
tags:
only: /v[0-9]+.*/
branches:
ignore: /.*/
- request_publication_approval:
type: approval
requires:
- test_deploy
filters:
tags:
only: /v[0-9]+.*/
branches:
ignore: /.*/
- deploy:
context: "NuCypher PyPI"
requires:
- request_publication_approval
filters:
tags:
only: /v[0-9]+.*/
branches:
ignore: /.*/
- actors
- deployers
- config
- character
#
# TODO: Initial Publication Automation
#
# - test_build:
# filters:
# tags:
# only: /.*/
# requires:
# - cli
# - ursula_command
# - test_deploy:
# context: "NuCypher PyPI"
# requires:
# - test_build
# filters:
# tags:
# only: /v[0-9]+.*/
# branches:
# ignore: /.*/
# - request_publication_approval:
# type: approval
# requires:
# - test_deploy
# filters:
# tags:
# only: /v[0-9]+.*/
# branches:
# ignore: /.*/
# - deploy:
# context: "NuCypher PyPI"
# requires:
# - request_publication_approval
# filters:
# tags:
# only: /v[0-9]+.*/
# branches:
# ignore: /.*/
#
python_36_base: &python_36_base
@ -208,23 +225,46 @@ jobs:
at: ~/.local/share/virtualenvs/
- run:
name: Blockchain Interface Tests
command: |
pipenv run pytest --cov=nucypher/blockchain/eth -v --runslow $(circleci tests glob tests/blockchain/eth/interfaces/**/test_*.py | circleci tests split --split-by=timings) --junitxml=./reports/pytest/blockchain_interface_results.xml
command: pipenv run pytest --cov=nucypher/blockchain/eth -v --runslow tests/blockchain/eth/interfaces --junitxml=./reports/pytest/results.xml
- run: *coveralls
- store_test_results:
path: ./reports/pytest/
blockchain_entities:
agents:
<<: *python_36_base
parallelism: 6
steps:
- checkout
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Blockchain Interface Tests
command: |
pipenv run pytest --cov=nucypher/blockchain/eth -v --runslow $(circleci tests glob tests/blockchain/eth/entities/**/test_*.py | circleci tests split --split-by=timings) --junitxml=./reports/pytest/blockchain_interface_results.xml
name: Blockchain Agent Tests
command: pipenv run pytest --cov=nucypher/blockchain/eth -v --runslow $(circleci tests glob tests/blockchain/eth/entities/agents/**/*.py | circleci tests split --split-by=timings) --junitxml=./reports/pytest/results.xml
- run: *coveralls
- store_test_results:
path: ./reports/pytest/
actors:
<<: *python_36_base
steps:
- checkout
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Blockchain Actor Tests
command: pipenv run pytest --cov=nucypher/blockchain/eth -v --runslow $(circleci tests glob tests/blockchain/eth/entities/actors/**/*.py | circleci tests split --split-by=timings) --junitxml=./reports/pytest/results.xml
- run: *coveralls
- store_test_results:
path: ./reports/pytest/
deployers:
<<: *python_36_base
steps:
- checkout
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Contract Deployer Tests
command: pipenv run pytest --cov=nucypher/blockchain/eth -v --runslow tests/blockchain/eth/entities/deployers --junitxml=./reports/pytest/results.xml
- run: *coveralls
- store_test_results:
path: ./reports/pytest/
@ -240,7 +280,6 @@ jobs:
name: Ethereum Contract Unit Tests
command: |
pipenv run pytest --junitxml=./reports/pytest/eth-contract-unit-report.xml -v --runslow $(circleci tests glob tests/blockchain/eth/contracts/**/**/test_*.py | circleci tests split --split-by=timings)
- run: *coveralls
- store_test_results:
path: ./reports/pytest/
@ -326,6 +365,7 @@ jobs:
- run:
name: Learner Tests
command: pipenv run pytest --cov=nucypher -v --runslow tests/learning --junitxml=./reports/pytest/results.xml
- run: *coveralls
- store_test_results:
path: ./reports/pytest/
@ -400,27 +440,20 @@ jobs:
command: |
pipenv install --three --dev --skip-lock --pre
pipenv install --dev --skip-lock twine
- run:
name: Verify git tag == __version__ (Test Deploy)
command: pipenv run python setup.py verify
- run:
name: Build Python Wheel
command: |
pipenv run python setup.py sdist
pipenv run python setup.py bdist_wheel -v
- run:
name: Destroy Build Enviorment
command: |
pipenv --rm --v
- run:
name: Install Nucypher via Wheel with Test Extra
name: Install Nucypher via Wheel
command: |
pip3 install --user ./dist/nucypher-0.1.0a0-py3-none-any.whl[test]
python -c "import nucypher; print(nucypher.__version__)"
- run:
name: Run Integrated Test Suite
name: Run Entrypoint Version Commands
command: |
nucypher-test
python -c "import nucypher; print(nucypher.__version__)"
nucypher --version
test_deploy:
<<: *python_36_base

View File

@ -2,5 +2,4 @@
test=pytest
[tool:pytest]
addopts = --runslow
python_files = tests/

View File

@ -113,14 +113,13 @@ setup(name=ABOUT['__title__'],
license=ABOUT['__license__'],
long_description=long_description,
setup_requires=['pytest-runner'],
setup_requires=['pytest-runner'], # required for setup.py test
tests_require=TESTS_REQUIRE,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
packages=find_packages(exclude=["tests"]),
package_data={PACKAGE_NAME: [
'tests/*',
'network/nicknames/web_colors.json',
'blockchain/eth/sol/source/contracts/*',
'blockchain/eth/sol/source/contracts/lib/*',
@ -134,7 +133,6 @@ setup(name=ABOUT['__title__'],
entry_points={'console_scripts': [
'{0} = {0}.cli.main:nucypher_cli'.format(PACKAGE_NAME),
'{0}-deploy = {0}.cli.deploy:deploy'.format(PACKAGE_NAME),
'{0}-test = tests.run_tests:run'.format(PACKAGE_NAME)
]},
cmdclass={'verify': VerifyVersionCommand},

View File

@ -17,15 +17,14 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
import os
from os.path import abspath, dirname
import maya
import pytest
class NucypherPytestRunner:
TEST_PATH = os.path.join(abspath(dirname(__file__)), 'cli')
PYTEST_ARGS = ['--verbose', '--runslow', TEST_PATH]
TEST_PATH = os.path.join('tests', 'cli')
PYTEST_ARGS = ['--verbose', TEST_PATH]
def pytest_sessionstart(self):
print("*** Running Nucypher CLI Tests ***")