8000 BUG: deal with broken hypot() for MSVC on win32 by pv · Pull Request #9574 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: deal with broken hypot() for MSVC on win32 #9574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 16, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
TST: add FPU mode check also for pytest
  • Loading branch information
pv committed Aug 16, 2017
commit 3deb8fa4f4d25e434c86188593f95dfc2fed041c
54 changes: 54 additions & 0 deletions numpy/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""
Pytest configuration and fixtures for the Numpy test suite.
"""
from __future__ import division, absolute_import, print_function

import warnings
import pytest

from numpy.core.multiarray_tests import get_fpu_mode


_old_fpu_mode = None
_collect_results = {}


@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))
0