MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _tests

Function _tests

noxfile.py:194–323  ·  view source on GitHub ↗
(
    session: nox.Session,
    database: str,
    cext: str = "_auto",
    greenlet: bool = True,
    backendonly: bool = False,
    platform_intensive: bool = False,
    timing_intensive: bool = True,
    coverage: bool = False,
)

Source from the content-addressed store, hash-verified

192
193
194def _tests(
195 session: nox.Session,
196 database: str,
197 cext: str = "_auto",
198 greenlet: bool = True,
199 backendonly: bool = False,
200 platform_intensive: bool = False,
201 timing_intensive: bool = True,
202 coverage: bool = False,
203) -> None:
204
205 # ensure external PYTHONPATH not interfering
206 session.env["PYTHONPATH"] = ""
207
208 # PYTHONNOUSERSITE - this *MUST* be set so that the ./lib/ import
209 # set up explicitly in test/conftest.py is *disabled*, so that
210 # when SQLAlchemy is built into the .nox area, we use that and not the
211 # local checkout, at least when usedevelop=False
212 session.env["PYTHONNOUSERSITE"] = "1"
213
214 freethreaded = isinstance(session.python, str) and session.python.endswith(
215 "t"
216 )
217
218 if freethreaded:
219 session.env["PYTHON_GIL"] = "0"
220
221 # greenlet frequently crashes with freethreading, so omit
222 # for the near future
223 greenlet = False
224
225 session.env["SQLALCHEMY_WARN_20"] = "1"
226
227 if cext == "cext":
228 session.env["REQUIRE_SQLALCHEMY_CEXT"] = "1"
229 elif cext == "nocext":
230 session.env["DISABLE_SQLALCHEMY_CEXT"] = "1"
231
232 includes_excludes: dict[str, list[str]] = {"k": [], "m": []}
233
234 if coverage:
235 timing_intensive = False
236
237 if platform_intensive:
238 # platform_intensive refers to test/aaa_profiling/test_memusage.py.
239 # it's only run exclusively of all other tests. does not include
240 # greenlet related tests
241 greenlet = False
242 # with "-m memory_intensive", only that suite will run, all
243 # other tests will be deselected by pytest
244 includes_excludes["m"].append("memory_intensive")
245 elif backendonly:
246 # with "-m backendonly", only tests with the backend pytest mark
247 # (or pytestplugin equivalent, like __backend__) will be selected
248 # by pytest.
249 # memory intensive is deselected to prevent these from running
250 includes_excludes["m"].extend(["backend", "not memory_intensive"])
251 else:

Callers 5

testsFunction · 0.85
coverageFunction · 0.85
github_cext_greenletFunction · 0.85
github_cextFunction · 0.85
github_nocextFunction · 0.85

Calls 12

apply_pytest_optsFunction · 0.90
_setup_for_driverFunction · 0.85
splitMethod · 0.80
unlinkMethod · 0.80
endswithMethod · 0.45
appendMethod · 0.45
extendMethod · 0.45
getMethod · 0.45
runMethod · 0.45
itemsMethod · 0.45
joinMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected