$33 GRAYBYTE WORDPRESS FILE MANAGER $78

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.15.130 | ADMIN IP 216.73.216.174
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/numpy//conftest.py
"""
Pytest configuration and fixtures for the Numpy test suite.
"""
import os
import tempfile

import hypothesis
import pytest
import numpy

from numpy.core._multiarray_tests import get_fpu_mode


_old_fpu_mode = None
_collect_results = {}

# Use a known and persistent tmpdir for hypothesis' caches, which
# can be automatically cleared by the OS or user.
hypothesis.configuration.set_hypothesis_home_dir(
    os.path.join(tempfile.gettempdir(), ".hypothesis")
)

# We register two custom profiles for Numpy - for details see
# https://hypothesis.readthedocs.io/en/latest/settings.html
# The first is designed for our own CI runs; the latter also 
# forces determinism and is designed for use via np.test()
hypothesis.settings.register_profile(
    name="numpy-profile", deadline=None, print_blob=True,
)
hypothesis.settings.register_profile(
    name="np.test() profile",
    deadline=None, print_blob=True, database=None, derandomize=True,
    suppress_health_check=list(hypothesis.HealthCheck),
)
# Note that the default profile is chosen based on the presence 
# of pytest.ini, but can be overridden by passing the 
# --hypothesis-profile=NAME argument to pytest.
_pytest_ini = os.path.join(os.path.dirname(__file__), "..", "pytest.ini")
hypothesis.settings.load_profile(
    "numpy-profile" if os.path.isfile(_pytest_ini) else "np.test() profile"
)

# The experimentalAPI is used in _umath_tests
os.environ["NUMPY_EXPERIMENTAL_DTYPE_API"] = "1"

def pytest_configure(config):
    config.addinivalue_line("markers",
        "valgrind_error: Tests that are known to error under valgrind.")
    config.addinivalue_line("markers",
        "leaks_references: Tests that are known to leak references.")
    config.addinivalue_line("markers",
        "slow: Tests that are very slow.")
    config.addinivalue_line("markers",
        "slow_pypy: Tests that are very slow on pypy.")


def pytest_addoption(parser):
    parser.addoption("--available-memory", action="store", default=None,
                     help=("Set amount of memory available for running the "
                           "test suite. This can result to tests requiring "
                           "especially large amounts of memory to be skipped. "
                           "Equivalent to setting environment variable "
                           "NPY_AVAILABLE_MEM. Default: determined"
                           "automatically."))


def pytest_sessionstart(session):
    available_mem = session.config.getoption('available_memory')
    if available_mem is not None:
        os.environ['NPY_AVAILABLE_MEM'] = available_mem


#FIXME when yield tests are gone.
@pytest.hookimpl()
def pytest_itemcollected(item):
    """
    Check FPU precision mode was not changed during test collection.

    The clumsy way we do it here is mainly necessary because numpy
    still uses yield tests, which can execute code at test collection
    time.
    """
    global _old_fpu_mode

    mode = get_fpu_mode()

    if _old_fpu_mode is None:
        _old_fpu_mode = mode
    elif mode != _old_fpu_mode:
        _collect_results[item] = (_old_fpu_mode, mode)
        _old_fpu_mode = mode


@pytest.fixture(scope="function", autouse=True)
def check_fpu_mode(request):
    """
    Check FPU precision mode was not changed during the test.
    """
    old_mode = get_fpu_mode()
    yield
    new_mode = get_fpu_mode()

    if old_mode != new_mode:
        raise AssertionError("FPU precision mode changed from {0:#x} to {1:#x}"
                             " during the test".format(old_mode, new_mode))

    collect_result = _collect_results.get(request.node)
    if collect_result is not None:
        old_mode, new_mode = collect_result
        raise AssertionError("FPU precision mode changed from {0:#x} to {1:#x}"
                             " when collecting the test".format(old_mode,
                                                                new_mode))


@pytest.fixture(autouse=True)
def add_np(doctest_namespace):
    doctest_namespace['np'] = numpy

@pytest.fixture(autouse=True)
def env_setup(monkeypatch):
    monkeypatch.setenv('PYTHONHASHSEED', '0')


@pytest.fixture(params=[True, False])
def weak_promotion(request):
    """
    Fixture to ensure "legacy" promotion state or change it to use the new
    weak promotion (plus warning).  `old_promotion` should be used as a
    parameter in the function.
    """
    state = numpy._get_promotion_state()
    if request.param:
        numpy._set_promotion_state("weak_and_warn")
    else:
        numpy._set_promotion_state("legacy")

    yield request.param
    numpy._set_promotion_state(state)


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
9 Apr 2026 8.31 AM
root / root
0755
__pycache__
--
11 Feb 2026 9.33 AM
root / root
0755
_pyinstaller
--
11 Feb 2026 9.30 AM
root / root
0755
_typing
--
11 Feb 2026 9.30 AM
root / root
0755
_utils
--
11 Feb 2026 9.30 AM
root / root
0755
array_api
--
11 Feb 2026 9.30 AM
root / root
0755
compat
--
11 Feb 2026 9.30 AM
root / root
0755
core
--
11 Feb 2026 9.30 AM
root / root
0755
distutils
--
11 Feb 2026 9.30 AM
root / root
0755
doc
--
11 Feb 2026 9.30 AM
root / root
0755
f2py
--
11 Feb 2026 9.30 AM
root / root
0755
fft
--
11 Feb 2026 9.30 AM
root / root
0755
lib
--
11 Feb 2026 9.30 AM
root / root
0755
linalg
--
11 Feb 2026 9.30 AM
root / root
0755
ma
--
11 Feb 2026 9.30 AM
root / root
0755
matrixlib
--
11 Feb 2026 9.30 AM
root / root
0755
polynomial
--
11 Feb 2026 9.30 AM
root / root
0755
random
--
11 Feb 2026 9.30 AM
root / root
0755
testing
--
11 Feb 2026 9.30 AM
root / root
0755
tests
--
11 Feb 2026 9.30 AM
root / root
0755
typing
--
11 Feb 2026 9.30 AM
root / root
0755
LICENSE.txt
44.621 KB
20 Jan 2026 1.01 PM
root / root
0644
__config__.py
5.022 KB
20 Jan 2026 1.01 PM
root / root
0644
__init__.cython-30.pxd
35.814 KB
20 Jan 2026 1.01 PM
root / root
0644
__init__.pxd
34.222 KB
20 Jan 2026 1.01 PM
root / root
0644
__init__.py
16.099 KB
20 Jan 2026 1.01 PM
root / root
0644
__init__.pyi
150.111 KB
20 Jan 2026 1.01 PM
root / root
0644
_distributor_init.py
0.323 KB
20 Jan 2026 1.01 PM
root / root
0644
_globals.py
3.021 KB
20 Jan 2026 1.01 PM
root / root
0644
_pytesttester.py
6.512 KB
20 Jan 2026 1.01 PM
root / root
0644
_pytesttester.pyi
0.478 KB
20 Jan 2026 1.01 PM
root / root
0644
_version.py
0.486 KB
20 Jan 2026 1.01 PM
root / root
0644
conftest.py
4.515 KB
20 Jan 2026 1.01 PM
root / root
0644
ctypeslib.py
16.843 KB
20 Jan 2026 1.01 PM
root / root
0644
ctypeslib.pyi
7.785 KB
20 Jan 2026 1.01 PM
root / root
0644
dtypes.py
2.177 KB
20 Jan 2026 1.01 PM
root / root
0644
dtypes.pyi
1.284 KB
20 Jan 2026 1.01 PM
root / root
0644
exceptions.py
7.167 KB
20 Jan 2026 1.01 PM
root / root
0644
exceptions.pyi
0.586 KB
20 Jan 2026 1.01 PM
root / root
0644
matlib.py
10.22 KB
20 Jan 2026 1.01 PM
root / root
0644
py.typed
0 KB
20 Jan 2026 1.01 PM
root / root
0644
setup.py
1.11 KB
20 Jan 2026 1.01 PM
root / root
0644
version.py
0.608 KB
20 Jan 2026 1.01 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF