Skip to content

Commit cdb0d0f

Browse files
committed
add prerelease deps
1 parent d9edc06 commit cdb0d0f

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

db_dtypes/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def construct_from_string(cls, name: str):
3636
raise TypeError(
3737
f"'construct_from_string' expects a string, got {type(name)}"
3838
)
39+
3940
if name != cls.name:
4041
raise TypeError(f"Cannot construct a '{cls.__name__}' from 'another_type'")
4142

noxfile.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from __future__ import absolute_import
2020
import os
2121
import pathlib
22+
import re
2223
import shutil
2324

2425
import nox
@@ -112,18 +113,106 @@ def default(session, tests_path):
112113
)
113114

114115

116+
def prerelease(session, tests_path):
117+
constraints_path = str(
118+
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
119+
)
120+
121+
# PyArrow prerelease packages are published to an alternative PyPI host.
122+
# https://arrow.apache.org/docs/python/install.html#installing-nightly-packages
123+
session.install(
124+
"--extra-index-url",
125+
"https://pypi.fury.io/arrow-nightlies/",
126+
"--prefer-binary",
127+
"--pre",
128+
"--upgrade",
129+
"pyarrow",
130+
)
131+
session.install(
132+
"--extra-index-url",
133+
"https://pypi.anaconda.org/scipy-wheels-nightly/simple",
134+
"--prefer-binary",
135+
"--pre",
136+
"--upgrade",
137+
"pandas",
138+
)
139+
session.install(
140+
"mock",
141+
"asyncmock",
142+
"pytest",
143+
"pytest-cov",
144+
"pytest-asyncio",
145+
"-c",
146+
constraints_path,
147+
)
148+
149+
# Because we test minimum dependency versions on the minimum Python
150+
# version, the first version we test with in the unit tests sessions has a
151+
# constraints file containing all dependencies and extras.
152+
with open(
153+
CURRENT_DIRECTORY
154+
/ "testing"
155+
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
156+
encoding="utf-8",
157+
) as constraints_file:
158+
constraints_text = constraints_file.read()
159+
160+
# Ignore leading whitespace and comment lines.
161+
deps = [
162+
match.group(1)
163+
for match in re.finditer(
164+
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
165+
)
166+
]
167+
168+
# We use --no-deps to ensure that pre-release versions aren't overwritten
169+
# by the version ranges in setup.py.
170+
session.install(*deps)
171+
session.install("--no-deps", "-e", ".")
172+
173+
# Print out prerelease package versions.
174+
session.run("python", "-m", "pip", "freeze")
175+
176+
# Run py.test against the unit tests.
177+
session.run(
178+
"py.test",
179+
"--quiet",
180+
f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml",
181+
"--cov=db_dtypes",
182+
"--cov=tests/unit",
183+
"--cov-append",
184+
"--cov-config=.coveragerc",
185+
"--cov-report=",
186+
"--cov-fail-under=0",
187+
tests_path,
188+
*session.posargs,
189+
)
190+
191+
115192
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])
116193
def compliance(session):
117194
"""Run the compliance test suite."""
118195
default(session, os.path.join("tests", "compliance"))
119196

120197

198+
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])
199+
def compliance_prerelease(session):
200+
"""Run the compliance test suite with prerelease dependencies."""
201+
prerelease(session, os.path.join("tests", "compliance"))
202+
203+
121204
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
122205
def unit(session):
123206
"""Run the unit test suite."""
124207
default(session, os.path.join("tests", "unit"))
125208

126209

210+
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])
211+
def unit_prerelease(session):
212+
"""Run the unit test suite with prerelease dependencies."""
213+
prerelease(session, os.path.join("tests", "unit"))
214+
215+
127216
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
128217
def system(session):
129218
"""Run the system test suite."""

0 commit comments

Comments
 (0)