Skip to content

test: disambiguate log files for flakybot #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
96 changes: 1 addition & 95 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,104 +115,10 @@ def default(session, tests_path):
)


def prerelease(session, tests_path):
constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)

# PyArrow prerelease packages are published to an alternative PyPI host.
# https://arrow.apache.org/docs/python/install.html#installing-nightly-packages
session.install(
"--extra-index-url",
"https://pypi.fury.io/arrow-nightlies/",
"--prefer-binary",
"--pre",
"--upgrade",
"pyarrow",
)
session.install(
"--extra-index-url",
"https://pypi.anaconda.org/scipy-wheels-nightly/simple",
"--prefer-binary",
"--pre",
"--upgrade",
"pandas",
)
session.install(
"mock",
"asyncmock",
"pytest",
"pytest-cov",
"pytest-asyncio",
"-c",
constraints_path,
)

# Because we test minimum dependency versions on the minimum Python
# version, the first version we test with in the unit tests sessions has a
# constraints file containing all dependencies and extras.
with open(
CURRENT_DIRECTORY
/ "testing"
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
encoding="utf-8",
) as constraints_file:
constraints_text = constraints_file.read()

# Ignore leading whitespace and comment lines.
deps = [
match.group(1)
for match in re.finditer(
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
)
]

# We use --no-deps to ensure that pre-release versions aren't overwritten
# by the version ranges in setup.py.
session.install(*deps)
session.install("--no-deps", "-e", ".")

# Print out prerelease package versions.
session.run("python", "-m", "pip", "freeze")

# Run py.test against the unit tests.
session.run(
"py.test",
"--quiet",
f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml",
"--cov=db_dtypes",
"--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=0",
tests_path,
*session.posargs,
)


@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])
def compliance(session):
"""Run the compliance test suite."""
default(session, os.path.join("tests", "compliance"))


@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])
def compliance_prerelease(session):
"""Run the compliance test suite with prerelease dependencies."""
prerelease(session, os.path.join("tests", "compliance"))


@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
def unit(session):
"""Run the unit test suite."""
default(session, os.path.join("tests", "unit"))


@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])
def unit_prerelease(session):
"""Run the unit test suite with prerelease dependencies."""
prerelease(session, os.path.join("tests", "unit"))
default(session)


@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
Expand Down
70 changes: 69 additions & 1 deletion owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,80 @@
s.replace(
["noxfile.py"],
r'''
def default\(session, tests_path\):
# Install all test dependencies, then install this package in-place.

constraints_path = str\(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
\)
session.install\(
"mock",
"asyncmock",
"pytest",
"pytest-cov",
"pytest-asyncio",
"-c",
constraints_path,
\)

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

# Run py.test against the unit tests.
session.run\(
"py.test",
"--quiet",
f"--junitxml={os.path.split\(tests_path\)[-1]}_{session.python}_sponge_log.xml",
"--cov=db_dtypes",
"--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=0",
tests_path,
*session.posargs,
\)


@nox.session\(python=UNIT_TEST_PYTHON_VERSIONS\)
def unit\(session\):
"""Run the unit test suite."""
default\(session\)
''',
r'''
def default(session, tests_path):
# Install all test dependencies, then install this package in-place.

constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
session.install(
"mock",
"asyncmock",
"pytest",
"pytest-cov",
"pytest-asyncio",
"-c",
constraints_path,
)

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

# Run py.test against the unit tests.
session.run(
"py.test",
"--quiet",
f"--junitxml={os.path.split(tests_path)[-1]}_{session.python}_sponge_log.xml",
"--cov=db_dtypes",
"--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=0",
tests_path,
*session.posargs,
)


def prerelease(session, tests_path):
constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
Expand Down Expand Up @@ -154,7 +222,7 @@ def prerelease(session, tests_path):
session.run(
"py.test",
"--quiet",
f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml",
f"--junitxml={os.path.split(tests_path)[-1]}_prerelease_{session.python}_sponge_log.xml",
"--cov=db_dtypes",
"--cov=tests/unit",
"--cov-append",
Expand Down