Skip to content

Commit

Permalink
Better tests on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rth committed Apr 29, 2018
1 parent dbdc805 commit 16faffe
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions neurtu/tests/test_blas.py
Expand Up @@ -4,7 +4,6 @@
from __future__ import division

import os
import sys
from glob import glob
import subprocess

Expand Down Expand Up @@ -56,7 +55,7 @@ def test_detect_blas():


@pytest.mark.skipif(np is None, reason='numpy not installed')
@pytest.mark.skipif(sys.name == 'nt',
@pytest.mark.skipif(os.name == 'nt',
reason='Loading BLAS DLL fails on Windows for now')
@pytest.mark.parametrize('blas_name', ['mkl', 'openblas', 'blas'])
def test_blas_set_threads(blas_name):
Expand Down Expand Up @@ -84,3 +83,22 @@ def test_blas_set_threads(blas_name):
blas.set_num_threads(num_threads_0)

assert blas.get_num_threads() == num_threads_0


@pytest.mark.skipif(np is None, reason='numpy not installed')
@pytest.mark.skipif(os.name == 'nt',
reason='Loading BLAS DLL fails on Windows for now')
def test_blas_autodetect():
blas = Blas()
name, dll_path = detect_blas()
assert blas.name == name
assert blas.dll_path == dll_path


@pytest.mark.skipif(os.name != 'nt',
reason='Windows only test')
@pytest.mark.skipif(np is None, reason='numpy not installed')
def test_blas_fails_on_windows():
with pytest.raises(OSError) as excinfo:
Blas()
assert "is not a valid Win32 application" in str(excinfo.value)

0 comments on commit 16faffe

Please sign in to comment.