Skip to content

Commit

Permalink
Add separate crypto sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
s0undt3ch committed May 8, 2019
1 parent 0399620 commit d3ae77b
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 24 deletions.
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
109 changes: 93 additions & 16 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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:
Expand Down

0 comments on commit d3ae77b

Please sign in to comment.