File: conftest.py

package info (click to toggle)
python-sparse 0.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,816 kB
  • sloc: python: 11,223; sh: 54; javascript: 10; makefile: 8
file content (28 lines) | stat: -rw-r--r-- 724 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
28
import pathlib

import sparse

import pytest


@pytest.fixture(scope="session", autouse=True)
def add_doctest_modules(doctest_namespace):
    import sparse

    import numpy as np

    doctest_namespace["np"] = np
    doctest_namespace["sparse"] = sparse


def pytest_ignore_collect(collection_path: pathlib.Path, config: pytest.Config) -> bool | None:
    if "numba_backend" in collection_path.parts and sparse._BackendType.Numba != sparse._BACKEND:
        return True

    if "mlir_backend" in collection_path.parts and sparse._BackendType.MLIR != sparse._BACKEND:
        return True

    if "finch_backend" in collection_path.parts and sparse._BackendType.Finch != sparse._BACKEND:
        return True

    return None