File: test_all.py

package info (click to toggle)
pytables 3.10.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,228 kB
  • sloc: ansic: 82,212; python: 65,296; cpp: 753; sh: 394; makefile: 100
file content (59 lines) | stat: -rw-r--r-- 1,784 bytes parent folder | download | duplicates (2)
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
"""Run all test cases."""

import os
import sys
import faulthandler

import numpy as np
from packaging.version import Version

import tables as tb
from tables.tests import common
from tables.tests.test_suite import suite, test

# Give people a way to opt out of enabling faulthandler
if os.getenv("PYTABLES_DISABLE_FAULTHANDLER", "").lower() not in ("1", "true"):
    faulthandler.enable()


def get_tuple_version(hexversion):
    """Get a tuple from a compact version in hex."""

    h = hexversion
    return (h & 0xFF0000) >> 16, (h & 0xFF00) >> 8, h & 0xFF


if __name__ == "__main__":

    common.parse_argv(sys.argv)

    hdf5_version = get_tuple_version(tb.which_lib_version("hdf5")[0])
    hdf5_version_str = "%s.%s.%s" % hdf5_version
    if Version(hdf5_version_str) < tb.req_versions.min_hdf5_version:
        print(
            f"*Warning*: HDF5 version is lower than recommended: "
            f"{hdf5_version} < {tb.req_versions.min_hdf5_version}"
        )

    if Version(np.__version__) < tb.req_versions.min_numpy_version:
        print(
            f"*Warning*: NumPy version is lower than recommended: "
            f"{np.__version__} < {tb.req_versions.min_numpy_version}"
        )

    # Handle some global flags (i.e. only useful for test_all.py)
    only_versions = 0
    args = sys.argv[:]
    for arg in args:
        # Remove 'show-versions' for PyTables 2.3 or higher
        if arg in ["--print-versions", "--show-versions"]:
            only_versions = True
            sys.argv.remove(arg)
        elif arg == "--show-memory":
            common.show_memory = True
            sys.argv.remove(arg)

    common.print_versions()
    if not only_versions:
        common.print_heavy(common.heavy)
        common.unittest.main(defaultTest="tb.tests.suite")