Skip to content

Commit

Permalink
WIP: move psyneulink integration tests to folder
Browse files Browse the repository at this point in the history
  • Loading branch information
kmantel committed Dec 5, 2023
1 parent 142ba94 commit 67481bb
Show file tree
Hide file tree
Showing 4 changed files with 1,002 additions and 980 deletions.
33 changes: 0 additions & 33 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,10 @@
import doctest
import pytest

from psyneulink.core import llvm as pnlvm


def pytest_runtest_setup(item):
if 'cuda' in item.keywords and not pnlvm.ptx_enabled:
pytest.skip('PTX engine not enabled/available')

doctest.ELLIPSIS_MARKER = "[...]"

def pytest_generate_tests(metafunc):
if "comp_mode_no_llvm" in metafunc.fixturenames:
modes = [m for m in get_comp_execution_modes()
if m.values[0] is not pnlvm.ExecutionMode.LLVM]
metafunc.parametrize("comp_mode", modes)

elif "comp_mode" in metafunc.fixturenames:
metafunc.parametrize("comp_mode", get_comp_execution_modes())


def pytest_runtest_teardown(item):
pnlvm.cleanup()

@pytest.fixture
def comp_mode_no_llvm():
# dummy fixture to allow 'comp_mode' filtering
pass

@pytest.helpers.register
def get_comp_execution_modes():
return [pytest.param(pnlvm.ExecutionMode.Python),
pytest.param(pnlvm.ExecutionMode.LLVM, marks=pytest.mark.llvm),
pytest.param(pnlvm.ExecutionMode.LLVMExec, marks=pytest.mark.llvm),
pytest.param(pnlvm.ExecutionMode.LLVMRun, marks=pytest.mark.llvm),
pytest.param(pnlvm.ExecutionMode.PTXExec, marks=[pytest.mark.llvm, pytest.mark.cuda]),
pytest.param(pnlvm.ExecutionMode.PTXRun, marks=[pytest.mark.llvm, pytest.mark.cuda])
]


# TODO: remove this helper when tests no longer use psyneulink
@pytest.helpers.register
Expand Down
41 changes: 41 additions & 0 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import pytest

try:
from psyneulink.core import llvm as pnlvm
except Exception:
# psyneulink unavailable
pass
else:
def pytest_runtest_setup(item):
if 'cuda' in item.keywords and not pnlvm.ptx_enabled:
pytest.skip('PTX engine not enabled/available')

def pytest_generate_tests(metafunc):
if "comp_mode_no_llvm" in metafunc.fixturenames:
modes = [
m for m in get_comp_execution_modes()
if m.values[0] is not pnlvm.ExecutionMode.LLVM
]
metafunc.parametrize("comp_mode", modes)

elif "comp_mode" in metafunc.fixturenames:
metafunc.parametrize("comp_mode", get_comp_execution_modes())

def pytest_runtest_teardown(item):
pnlvm.cleanup()

@pytest.fixture
def comp_mode_no_llvm():
# dummy fixture to allow 'comp_mode' filtering
pass

@pytest.helpers.register
def get_comp_execution_modes():
return [
pytest.param(pnlvm.ExecutionMode.Python),
pytest.param(pnlvm.ExecutionMode.LLVM, marks=pytest.mark.llvm),
pytest.param(pnlvm.ExecutionMode.LLVMExec, marks=pytest.mark.llvm),
pytest.param(pnlvm.ExecutionMode.LLVMRun, marks=pytest.mark.llvm),
pytest.param(pnlvm.ExecutionMode.PTXExec, marks=[pytest.mark.llvm, pytest.mark.cuda]),
pytest.param(pnlvm.ExecutionMode.PTXRun, marks=[pytest.mark.llvm, pytest.mark.cuda])
]

0 comments on commit 67481bb

Please sign in to comment.