本文整理汇总了Python中nox.session方法的典型用法代码示例。如果您正苦于以下问题:Python nox.session方法的具体用法?Python nox.session怎么用?Python nox.session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nox
的用法示例。
在下文中一共展示了nox.session方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: default
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def default(session):
# Install all test dependencies, then install this package in-place.
session.install("mock", "pytest", "pytest-cov")
session.install("-e", ".")
# Run py.test against the unit tests.
session.run(
"py.test",
"--quiet",
"--cov=google.cloud.firestore",
"--cov=google.cloud",
"--cov=tests.unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=0",
os.path.join("tests", "unit"),
*session.posargs,
)
示例2: docs
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def docs(session):
"""Build the docs for this library."""
session.install("-e", ".")
session.install("sphinx<3.0.0", "alabaster", "recommonmark")
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
session.run(
"sphinx-build",
"-W", # warnings as errors
"-T", # show full traceback on exception
"-N", # no colors
"-b",
"html",
"-d",
os.path.join("docs", "_build", "doctrees", ""),
os.path.join("docs", ""),
os.path.join("docs", "_build", "html", ""),
)
示例3: lint
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def lint(session):
session.interpreter = 'python3.6'
session.install(
'flake8', 'flake8-import-order', 'pylint', 'docutils',
'gcp-devrel-py-tools>=0.0.3')
session.install('.')
session.run(
'python', 'setup.py', 'check', '--metadata',
'--restructuredtext', '--strict')
session.run(
'flake8',
'--import-order-style=google',
'--application-import-names=google,tests',
'--ignore=E501,I202',
'--exclude=gapic,fixtures',
'google', 'tests')
session.run(
'gcp-devrel-py-tools', 'run-pylint',
'--config', 'pylint.conf.py',
'--library-filesets', 'google',
'--test-filesets', 'tests',
success_codes=range(0, 31))
示例4: run_black
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def run_black(session, use_check=False):
args = ["black"]
if use_check:
args.append("--check")
args.extend(
[
"--line-length=79",
get_path("docs"),
get_path("noxfile.py"),
get_path("google"),
get_path("tests"),
]
)
session.run(*args)
示例5: doctest
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def doctest(session):
# Install all dependencies.
session.install("Sphinx")
session.install("sphinxcontrib.spelling")
session.install(".")
# Run the script for building docs and running doctests.
run_args = [
"sphinx-build",
"-W",
"-b",
"doctest",
"-d",
get_path("docs", "_build", "doctrees"),
get_path("docs"),
get_path("docs", "_build", "doctest"),
]
session.run(*run_args)
示例6: install_packages
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def install_packages(session, package_a, package_b, command_a, command_b):
session.chdir(package_a)
session.run('rm', '-rf', 'dist', 'build', '*.egg-info')
session.run(*command_a)
session.chdir(HERE)
session.chdir(package_b)
session.run('rm', '-rf', 'dist', 'build', '*.egg-info')
session.run(*command_b)
session.chdir(HERE)
示例7: session_pkgutil
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def session_pkgutil(session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'pkgutil/pkg_a', 'pkgutil/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
示例8: session_pkg_resources
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def session_pkg_resources(session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'pkg_resources/pkg_a', 'pkg_resources/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
示例9: session_pep420
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
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')
示例10: session_cross_pkg_resources_pkgutil
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def session_cross_pkg_resources_pkgutil(
session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'pkg_resources/pkg_a', 'pkgutil/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
示例11: test
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def test(session, sqlalchemy, hana_driver):
if 'NOX_SAP_HANA_URI' not in os.environ:
session.skip(
"Environment variable NOX_SAP_HANA_URI must be defined. "
"Example: NOX_SAP_HANA_URI=USERNAME:PASSWORD@sap-hana-host:PORT"
)
pip_env = {}
if PIP_INDEX_URL:
session.log('Use and trust custom index url from NOX_PIP_INDEX_URL')
pip_env = {
'PIP_INDEX_URL': PIP_INDEX_URL,
'PIP_TRUSTED_HOST': urlparse(PIP_INDEX_URL).netloc
}
session.install('sqlalchemy~={}.0'.format(sqlalchemy))
session.install(hana_driver, env=pip_env)
session.install('.[test]')
dburi = 'hana+' + hana_driver + '://' + os.environ['NOX_SAP_HANA_URI']
session.run(
'pytest',
'--dburi', dburi,
'--requirements', 'sqlalchemy_hana.requirements:Requirements',
*session.posargs
)
示例12: _install_dev_packages
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def _install_dev_packages(session):
session.install("-e", ".")
示例13: _install_test_dependencies
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def _install_test_dependencies(session):
session.install("pytest")
session.install("pytest-cov")
session.install("responses")
示例14: _install_doc_dependencies
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def _install_doc_dependencies(session):
session.install("sphinx")
示例15: tests
# 需要导入模块: import nox [as 别名]
# 或者: from nox import session [as 别名]
def tests(session):
_install_dev_packages(session)
_install_test_dependencies(session)
session.install("pytest")
session.run("pytest")
session.notify("cover")