Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@nox.parametrize("sample", GAE_STANDARD_SAMPLES)
def gae(session, sample):
"""Runs py.test for an App Engine standard sample."""
# Create a lib directory if needed, otherwise the App Engine vendor library
# will complain.
if not os.path.isdir(os.path.join(sample, "lib")):
os.mkdir(os.path.join(sample, "lib"))
_session_tests(session, sample, _setup_appengine_sdk)
@nox.parametrize('interpreter', ['python2.7', 'python3.4', 'python3.5'])
def session_tests(session, interpreter):
session.interpreter = interpreter
run_tests(session, 'requirements-dev.txt')
@nox.parametrize('version', ['3.4', '3.5', '3.6', '3.7'])
def tests(session, version):
session.interpreter = 'python' + version
session.install('-r', 'scripts/requirements-test.txt')
session.run(
'py.test',
'--ignore=scripts/testdata',
'--cov=scripts',
'--cov-append',
'--cov-config=.coveragerc',
'--cov-report=', # Report generated below
'scripts',
env={'PYTHONPATH': ''}
)
@nox.parametrize('coverage', [False, True])
def pytest_zeromq_pycryptodomex(session, coverage):
'''
pytest session with zeromq transport and pycryptodomex
'''
session.notify(
'pytest-parametrized-{}(coverage={}, crypto=\'pycryptodomex\', transport=\'zeromq\')'.format(
session.python,
coverage
)
@nox.parametrize(
"requests", [nox.param("2.21.0", id="latest"), nox.param("2.20.0", id="previous")]
)
def tests(session, requests):
session.install(f"requests=={requests}")
session.run("pytest")
@nox.parametrize("sample", SAMPLES_WITH_GENERATED_READMES)
def readmegen(session, sample):
"""(Re-)generates the readme for a sample."""
session.install("jinja2", "pyyaml")
if os.path.exists(os.path.join(sample, "requirements.txt")):
session.install("-r", os.path.join(sample, "requirements.txt"))
in_file = os.path.join(sample, "README.rst.in")
session.run("python", "scripts/readme-gen/readme_gen.py", in_file)
@nox.parametrize('command_b', install_commands)
def session_pep420(session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'native/pkg_a', 'native/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
@nox.parametrize('coverage', [False, True])
def runtests_tcp(session, coverage):
'''
runtests.py session with TCP transport and default crypto
'''
session.notify(
'runtests-parametrized-{}(coverage={}, crypto=None, transport=\'tcp\')'.format(
session.python,
coverage
)
@nox.parametrize('python_version', ['2.7', '3.4', '3.5', '3.6'])
def unit_tests(session, python_version):
"""Run the unit test suite."""
# Run unit tests against all supported versions of Python.
session.interpreter = 'python{}'.format(python_version)
# Install all test dependencies, then install this package in-place.
session.install('mock', 'pytest', 'pytest-cov', 'pyfakefs',
'restructuredtext_lint')
session.install('-e', '.')
# Run py.test against the unit tests.
session.run('py.test', '-rxs', '--cov', '--cov-append', '--cov-report=')
@nox.parametrize("pytorch", PYTORCH_VERSIONS, ids=PYTORCH_IDS)
def tests_brevitas_install_dev(session, pytorch):
install_pytorch(pytorch, session)
session.install('-e', '.[test]')
session.run('pytest', '-v', 'test/brevitas/test_import.py')