Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 63 additions & 7 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Generated by synthtool. DO NOT EDIT!

from __future__ import absolute_import
import os
import pathlib
import shutil

import nox

# 'update_lower_bounds' is excluded
nox.options.sessions = [
"lint",
"blacken",
"lint_setup_py",
"unit",
"check_lower_bounds"
]


BLACK_VERSION = "black==19.3b0"
BLACK_PATHS = ["test_utils", "setup.py"]
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()


@nox.session(python="3.7")
def lint(session):
Expand All @@ -35,9 +46,7 @@ def lint(session):
"""
session.install("flake8", BLACK_VERSION)
session.run(
"black",
"--check",
*BLACK_PATHS,
"black", "--check", *BLACK_PATHS,
)
session.run("flake8", *BLACK_PATHS)

Expand All @@ -54,13 +63,60 @@ def blacken(session):
"""
session.install(BLACK_VERSION)
session.run(
"black",
*BLACK_PATHS,
"black", *BLACK_PATHS,
)


@nox.session(python="3.7")
def lint_setup_py(session):
"""Verify that setup.py is valid (including RST check)."""
session.install("docutils", "pygments")
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")


@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
def unit(session):
constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)

# Install two fake packages for the lower-bound-checker tests
session.install("-e", "tests/unit/resources/good_package", "tests/unit/resources/bad_package")

session.install("pytest")
session.install("-e", ".", "-c", constraints_path)

# Run py.test against the unit tests.
session.run(
"py.test",
"--quiet",
os.path.join("tests", "unit"),
*session.posargs,
)

@nox.session(python="3.8")
def check_lower_bounds(session):
"""Check lower bounds in setup.py are reflected in constraints file"""
session.install(".")
session.run(
"lower-bound-checker",
"check",
"--package-name",
"google-cloud-testutils",
"--constraints-file",
"testing/constraints-3.6.txt",
)


@nox.session(python="3.8")
def update_lower_bounds(session):
"""Update lower bounds in constraints.txt to match setup.py"""
session.install(".")
session.run(
"lower-bound-checker",
"update",
"--package-name",
"google-cloud-testutils",
"--constraints-file",
"testing/constraints-3.6.txt",
)
12 changes: 11 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
with io.open(readme_filename, encoding="utf-8") as readme_file:
readme = readme_file.read()

scripts = (
["lower-bound-checker=test_utils.lower_bound_checker.lower_bound_checker:main"],
)

setuptools.setup(
name="google-cloud-testutils",
version=version,
Expand All @@ -33,9 +37,15 @@
license="Apache 2.0",
url="https://github.com/googleapis/python-test-utils",
packages=setuptools.PEP420PackageFinder.find(),
entry_points={"console_scripts": scripts},
platforms="Posix; MacOS X; Windows",
include_package_data=True,
install_requires=("google-auth >= 0.4.0", "six"),
install_requires=(
"google-auth >= 0.4.0",
"six>=1.9.0",
"click>=7.0.0",
"packaging>=19.0",
),
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
classifiers=[
"Development Status :: 4 - Beta",
Expand Down
Empty file.
Loading