Commit 01a56d31 authored by Michael Kuron's avatar Michael Kuron
Browse files

skip tests with unmet dependencies

parent 3078eb30
......@@ -44,7 +44,7 @@ collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/autodiff.py")]
try:
import pycuda
except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/pystencils_tests/test_cudagpu.py")]
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_cudagpu.py")]
add_path_to_ignore('pystencils/gpucuda')
try:
......@@ -73,7 +73,22 @@ try:
import blitzdb
except ImportError:
add_path_to_ignore('pystencils/runhelper')
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_parameterstudy.py")]
try:
import islpy
except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/integer_set_analysis.py")]
try:
import graphviz
except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/backends/dot.py")]
try:
import pyevtk
except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/datahandling/vtk.py")]
collect_ignore += [os.path.join(SCRIPT_FOLDER, 'setup.py')]
......@@ -131,7 +146,7 @@ class IPyNbFile(pytest.File):
exporter.exclude_markdown = True
exporter.exclude_input_prompt = True
notebook_contents = self.fspath.open()
notebook_contents = self.fspath.open(encoding='utf-8')
with warnings.catch_warnings():
warnings.filterwarnings("ignore", "IPython.core.inputsplitter is deprecated")
......
......@@ -79,14 +79,14 @@ def create_kernel(assignments,
[0., 0., 0., 0., 0.]])
"""
# ---- Normalizing parameters
if isinstance(assignments, Assignment):
assignments = [assignments]
assert assignments, "Assignments must not be empty!"
split_groups = ()
if isinstance(assignments, AssignmentCollection):
if 'split_groups' in assignments.simplification_hints:
split_groups = assignments.simplification_hints['split_groups']
assignments = assignments.all_assignments
if isinstance(assignments, Assignment):
assignments = [assignments]
# ---- Creating ast
if target == 'cpu':
......
from subprocess import CalledProcessError
import pycuda.driver
import pytest
import sympy
......@@ -25,7 +24,7 @@ class ScreamingGpuBackend(CudaBackend):
return normal_code.upper()
def test_custom_backends():
def test_custom_backends_cpu():
z, x, y = pystencils.fields("z, y, x: [2d]")
normal_assignments = pystencils.AssignmentCollection([pystencils.Assignment(
......@@ -36,6 +35,16 @@ def test_custom_backends():
with pytest.raises(CalledProcessError):
pystencils.cpu.cpujit.make_python_function(ast, custom_backend=ScreamingBackend())
def test_custom_backends_gpu():
pytest.importorskip('pycuda')
import pycuda.driver
z, x, y = pystencils.fields("z, y, x: [2d]")
normal_assignments = pystencils.AssignmentCollection([pystencils.Assignment(
z[0, 0], x[0, 0] * sympy.log(x[0, 0] * y[0, 0]))], [])
ast = pystencils.create_kernel(normal_assignments, target='gpu')
print(pystencils.show_code(ast, ScreamingGpuBackend()))
with pytest.raises(pycuda.driver.CompileError):
......
......@@ -11,8 +11,6 @@ import itertools
from os.path import dirname, join
import numpy as np
import pycuda.autoinit # NOQA
import pycuda.gpuarray as gpuarray
import pytest
import sympy
......@@ -112,6 +110,9 @@ def test_rotate_interpolation(address_mode):
@pytest.mark.parametrize('address_mode', ['border', 'wrap', 'clamp', 'mirror'])
def test_rotate_interpolation_gpu(address_mode):
pytest.importorskip('pycuda')
import pycuda.autoinit # NOQA
import pycuda.gpuarray as gpuarray
rotation_angle = sympy.pi / 5
scale = 1
......@@ -156,6 +157,9 @@ def test_rotate_interpolation_gpu(address_mode):
@pytest.mark.parametrize('address_mode', ['border', 'wrap', 'clamp', 'mirror'])
def test_shift_interpolation_gpu(address_mode):
pytest.importorskip('pycuda')
import pycuda.autoinit # NOQA
import pycuda.gpuarray as gpuarray
rotation_angle = 0 # sympy.pi / 5
scale = 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment