|
19 | 19 | from __future__ import absolute_import
|
20 | 20 | import os
|
21 | 21 | import pathlib
|
| 22 | +import re |
22 | 23 | import shutil
|
23 | 24 |
|
24 | 25 | import nox
|
@@ -112,18 +113,106 @@ def default(session, tests_path):
|
112 | 113 | )
|
113 | 114 |
|
114 | 115 |
|
| 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 | + |
115 | 192 | @nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])
|
116 | 193 | def compliance(session):
|
117 | 194 | """Run the compliance test suite."""
|
118 | 195 | default(session, os.path.join("tests", "compliance"))
|
119 | 196 |
|
120 | 197 |
|
| 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 | + |
121 | 204 | @nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
|
122 | 205 | def unit(session):
|
123 | 206 | """Run the unit test suite."""
|
124 | 207 | default(session, os.path.join("tests", "unit"))
|
125 | 208 |
|
126 | 209 |
|
| 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 | + |
127 | 216 | @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
|
128 | 217 | def system(session):
|
129 | 218 | """Run the system test suite."""
|
|
0 commit comments