Repository navigation
Expand file tree
/
Copy pathconftest.py
More file actions
61 lines (49 loc) · 1.74 KB
/
Copy pathconftest.py
File metadata and controls
61 lines (49 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from __future__ import annotations
import builtins
import os
import platform
from pathlib import Path
import pytest
import ibis
SANDBOXED = (
any(key.startswith("NIX_") for key in os.environ)
and os.environ.get("IN_NIX_SHELL") != "impure"
)
LINUX = platform.system() == "Linux"
MACOS = platform.system() == "Darwin"
WINDOWS = platform.system() == "Windows"
ARM64 = platform.machine() in ("arm64", "aarch64")
CI = os.environ.get("CI") is not None
SPARK_REMOTE = os.environ.get("SPARK_REMOTE")
IS_SPARK_REMOTE = bool(SPARK_REMOTE)
@pytest.fixture(autouse=True)
def add_ibis(monkeypatch, doctest_namespace):
# disable color for doctests so we don't have to include
# escape codes in docstrings
monkeypatch.setitem(os.environ, "NO_COLOR", "1")
# Explicitly set the column width
monkeypatch.setitem(os.environ, "COLUMNS", "80")
# reset interactive mode to False for doctests that don't execute
# expressions
ibis.options.interactive = False
# workaround the fact that doctests include everything in the tested module
# for selectors we have an `all` function as well as `ibis.range`
#
# the clashes don't really pop up in practice because it's unlikely for
# people to write `from $MODULE_BEING_TESTED import *`
doctest_namespace["all"] = builtins.all
doctest_namespace["range"] = builtins.range
not_windows = pytest.mark.skipif(
condition=WINDOWS,
reason="windows prevents two connections to the same file even in the same process",
)
@pytest.fixture(scope="session")
def data_dir() -> Path:
"""Return the test data directory.
Returns
-------
Path
Test data directory
"""
root = Path(__file__).absolute().parents[1]
return root / "ci" / "ibis-testing-data"