File: conftest.py

package info (click to toggle)
python-geopandas 0.12.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,464 kB
  • sloc: python: 21,174; makefile: 149; sh: 25
file content (27 lines) | stat: -rw-r--r-- 694 bytes parent folder | download
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
import pytest
import geopandas


@pytest.fixture(autouse=True)
def add_geopandas(doctest_namespace):
    doctest_namespace["geopandas"] = geopandas


def pytest_configure(config):
    config.addinivalue_line(
        "markers",
        "skip_no_sindex: skips the tests if there is no spatial index backend",
    )


try:
    geopandas.sindex._get_sindex_class()
    has_sindex_backend = True
except ImportError:
    has_sindex_backend = False


def pytest_runtest_setup(item):
    skip_no_sindex = any(mark for mark in item.iter_markers(name="skip_no_sindex"))
    if skip_no_sindex and not has_sindex_backend:
        pytest.skip("Skipped because there is no spatial index backend available")