File: conftest.py

package info (click to toggle)
tifffile 20230203-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,884 kB
  • sloc: python: 35,592; makefile: 14
file content (56 lines) | stat: -rw-r--r-- 1,579 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
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
# tifffile/tests/conftest.py

import os
import sys

if os.environ.get('VSCODE_CWD'):
    # work around pytest not using PYTHONPATH in VSCode
    sys.path.insert(
        0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
    )

if os.environ.get('SKIP_CODECS', None):
    sys.modules['imagecodecs'] = None  # type: ignore


def pytest_report_header(config):
    try:
        from numpy import __version__ as numpy
        from tifffile import __version__ as tifffile
        from test_tifffile import config

        try:
            from imagecodecs import __version__ as imagecodecs
        except ImportError:
            imagecodecs = 'N/A'
        try:
            from zarr import __version__ as zarr
        except ImportError:
            zarr = 'N/A'
        try:
            from dask import __version__ as dask
        except ImportError:
            dask = 'N/A'
        try:
            from xarray import __version__ as xarray
        except ImportError:
            xarray = 'N/A'
        try:
            from fsspec import __version__ as fsspec
        except ImportError:
            fsspec = 'N/A'
        return (
            f'versions: tifffile-{tifffile}, '
            f'imagecodecs-{imagecodecs}, '
            f'numpy-{numpy}, '
            f'zarr-{zarr}, '
            f'dask-{dask}, '
            f'xarray-{xarray}, '
            f'fsspec-{fsspec}\n'
            f'test config: {config()}'
        )
    except Exception:
        pass


collect_ignore = ['_tmp', 'data', 'data-']