Add separate crypto sessions

This commit is contained in:
Pedro Algarvio 2019-03-25 15:07:39 +00:00
parent 0399620a5a
commit d3ae77b37d
No known key found for this signature in database
GPG Key ID: BB36BF6584A298FF
2 changed files with 101 additions and 24 deletions

View File

@ -6,7 +6,7 @@ repos:
- id: pip-tools-compile
alias: compile-linux-py3-zmq-requirements
name: Linux Py3 ZeroMQ Requirements
files: ^requirements/static/(.*)\.in$
files: ^requirements/((base|zeromq|pytest)\.txt|static/(.*)\.in)$
exclude: ^requirements/static/windows\.in$
args:
- --out-prefix=zeromq
@ -16,7 +16,7 @@ repos:
- id: pip-tools-compile
alias: compile-linux-py2-zmq-requirements
name: Linux Py2 ZeroMQ Requirements
files: ^requirements/static/(.*)\.in$
files: ^requirements/((base|zeromq|pytest)\.txt|static/(.*)\.in)$
exclude: ^requirements/static/windows\.in$
args:
- --out-prefix=zeromq
@ -26,7 +26,7 @@ repos:
- id: pip-tools-compile
alias: compile-linux-py3-raet-requirements
name: Linux Py3 RAET Requirements
files: ^requirements/static/(.*)\.in$
files: ^requirements/((base|raet|pytest)\.txt|static/(.*)\.in)$
exclude: ^requirements/static/windows\.in$
args:
- --out-prefix=raet
@ -36,7 +36,7 @@ repos:
- id: pip-tools-compile
alias: compile-linux-py2-raet-requirements
name: Linux Py2 RAET Requirements
files: ^requirements/static/(.*)\.in$
files: ^requirements/((base|raet|pytest)\.txt|static/(.*)\.in)$
exclude: ^requirements/static/windows\.in$
args:
- --out-prefix=raet
@ -46,7 +46,7 @@ repos:
- id: pip-tools-compile
alias: compile-windows-py3-zmq-requirements
name: Windows Py3 ZeroMQ Requirements
files: ^requirements/static/windows\.in$
files: ^requirements/((base|zeromq|pytest)\.txt|static/windows\.in)$
args:
- --platform=windows
- --out-prefix=zeromq
@ -56,7 +56,7 @@ repos:
- id: pip-tools-compile
alias: compile-windows-py2-zmq-requirements
name: Windows Py2 ZeroMQ Requirements
files: ^requirements/static/windows\.in$
files: ^requirements/((base|zeromq|pytest)\.txt|static/windows\.in)$
args:
- --platform=windows
- --out-prefix=zeromq
@ -66,7 +66,7 @@ repos:
- id: pip-tools-compile
alias: compile-windows-py3-raet-requirements
name: Windows Py3 RAET Requirements
files: ^requirements/static/windows\.in$
files: ^requirements/((base|raet|pytest)\.txt|static/windows\.in)$
args:
- --out-prefix=raet
- --platform=windows
@ -76,7 +76,7 @@ repos:
- id: pip-tools-compile
alias: compile-windows-py2-raet-requirements
name: Windows Py2 RAET Requirements
files: ^requirements/static/windows\.in$
files: ^requirements/((base|raet|pytest)\.txt|static/windows\.in)$
args:
- --out-prefix=raet
- --platform=windows

View File

@ -164,22 +164,9 @@ def _run_with_coverage(session, *test_cmd):
session.run('coverage', 'xml', '-o', os.path.join(REPO_ROOT, 'artifacts', 'coverage', 'coverage.xml'))
@nox.session(python=_PYTHON_VERSIONS)
@nox.parametrize('coverage', [False, True])
@nox.parametrize('transport', ['zeromq', 'raet'])
def runtests(session, coverage, transport):
# Install requirements
_install_requirements(session, transport, 'unittest-xml-reporting==2.2.1')
def _runtests(session, coverage, transport, cmd_args):
# Create required artifacts directories
_create_ci_directories()
cmd_args = [
'--tests-logfile={}'.format(
os.path.join(REPO_ROOT, 'artifacts', 'logs', 'runtests.log')
),
'--transport={}'.format(transport)
] + session.posargs
try:
if coverage is True:
_run_with_coverage(session, 'coverage', 'run', '-m', 'tests.runtests', *cmd_args)
@ -222,14 +209,61 @@ def runtests(session, coverage, transport):
session.run('python', os.path.join('tests', 'runtests.py'), *cmd_args)
@nox.session(python=_PYTHON_VERSIONS)
@nox.parametrize('coverage', [False, True])
@nox.parametrize('transport', ['zeromq', 'raet'])
def runtests(session, coverage, transport):
# Install requirements
_install_requirements(session, transport, 'unittest-xml-reporting==2.2.1')
cmd_args = [
'--tests-logfile={}'.format(
os.path.join(REPO_ROOT, 'artifacts', 'logs', 'runtests.log')
),
'--transport={}'.format(transport)
] + session.posargs
_runtests(session, coverage, transport, cmd_args)
def _runtests_crypto(session, coverage, transport, crypto):
# Install requirements
_install_requirements(session, transport, 'unittest-xml-reporting==2.2.1')
if crypto == 'm2crypto':
session.run('pip', 'uninstall', '-y', 'pycrypto', 'pycryptodome', 'pycryptodomex', silent=True)
else:
session.run('pip', 'uninstall', '-y', 'm2crypto', silent=True)
session.install(crypto)
cmd_args = [
'--tests-logfile={}'.format(
os.path.join(REPO_ROOT, 'artifacts', 'logs', 'runtests.log')
),
'--transport={}'.format(transport)
] + session.posargs
_runtests(session, coverage, transport, cmd_args)
@nox.session(python=_PYTHON_VERSIONS, name='runtests-m2crypto')
@nox.parametrize('coverage', [False, True])
@nox.parametrize('transport', ['zeromq', 'raet'])
def runtests_m2crypto(session, coverage, transport):
_runtests_crypto(session, coverage, transport, 'm2crypto')
@nox.session(python=_PYTHON_VERSIONS, name='runtests-pycryptodomex')
@nox.parametrize('coverage', [False, True])
@nox.parametrize('transport', ['zeromq', 'raet'])
def runtests_pycryptodomex(session, coverage, transport):
_runtests_crypto(session, coverage, transport, 'pycryptodomex')
@nox.session(python=_PYTHON_VERSIONS)
@nox.parametrize('coverage', [False, True])
@nox.parametrize('transport', ['zeromq', 'raet'])
def pytest(session, coverage, transport):
# Install requirements
_install_requirements(session, transport)
# Create required artifacts directories
_create_ci_directories()
cmd_args = [
'--rootdir', REPO_ROOT,
@ -241,6 +275,49 @@ def pytest(session, coverage, transport):
'-s',
'--transport={}'.format(transport)
] + session.posargs
_pytest(session, coverage, transport, cmd_args)
def _pytest_crypto(session, coverage, transport, crypto):
# Install requirements
_install_requirements(session, transport)
if crypto == 'm2crypto':
session.run('pip', 'uninstall', '-y', 'pycrypto', 'pycryptodome', 'pycryptodomex', silent=True)
else:
session.run('pip', 'uninstall', '-y', 'm2crypto', silent=True)
session.install(crypto)
cmd_args = [
'--rootdir', REPO_ROOT,
'--log-file={}'.format(
os.path.join(REPO_ROOT, 'artifacts', 'logs', 'runtests.log')
),
'--no-print-logs',
'-ra',
'-s',
'--transport={}'.format(transport)
] + session.posargs
_pytest(session, coverage, transport, cmd_args)
@nox.session(python=_PYTHON_VERSIONS, name='pytest-m2crypto')
@nox.parametrize('coverage', [False, True])
@nox.parametrize('transport', ['zeromq', 'raet'])
def pytest_m2crypto(session, coverage, transport):
_pytest_crypto(session, coverage, transport, 'm2crypto')
@nox.session(python=_PYTHON_VERSIONS, name='pytest-pycryptodomex')
@nox.parametrize('coverage', [False, True])
@nox.parametrize('transport', ['zeromq', 'raet'])
def pytest_pycryptodomex(session, coverage, transport):
_pytest_crypto(session, coverage, transport, 'pycryptodomex')
def _pytest(session, coverage, transport, cmd_args):
# Create required artifacts directories
_create_ci_directories()
try:
if coverage is True: