Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion thinc/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

# Functionally disable deadline settings for tests
# to prevent spurious test failures in CI builds.
settings.register_profile("no_deadlines", deadline=2*60*1000) # in ms
settings.register_profile("no_deadlines", deadline=2 * 60 * 1000) # in ms
settings.load_profile("no_deadlines")


def pytest_sessionstart(session):
# If Tensorflow is installed, attempt to enable memory growth
# to prevent it from allocating all of the GPU's free memory
Expand Down
19 changes: 9 additions & 10 deletions thinc/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ALL_XP = [numpy]
try:
import cupy

ALL_XP.append(cupy)
except ImportError:
pass
Expand Down Expand Up @@ -49,10 +50,12 @@ def test_get_width_fail(obj):

@pytest.mark.parametrize("xp", ALL_XP)
def test_array_module_cpu_gpu_helpers(xp):
error = ("Only numpy and cupy arrays are supported"
", but found <class 'int'> instead. If "
"get_array_module module wasn't called "
"directly, this might indicate a bug in Thinc.")
error = (
"Only numpy and cupy arrays are supported"
", but found <class 'int'> instead. If "
"get_array_module module wasn't called "
"directly, this might indicate a bug in Thinc."
)
with pytest.raises(ValueError, match=error):
get_array_module(0)
zeros = xp.zeros((1, 2))
Expand Down Expand Up @@ -135,14 +138,10 @@ def test_to_categorical(label_smoothing):
):
to_categorical(numpy.asarray([0, 0, 0]), label_smoothing=0.01),

with pytest.raises(
ValueError, match=r"label_smoothing parameter"
):
with pytest.raises(ValueError, match=r"label_smoothing parameter"):
to_categorical(numpy.asarray([0, 1, 2, 3, 4]), label_smoothing=0.8)

with pytest.raises(
ValueError, match=r"label_smoothing parameter"
):
with pytest.raises(ValueError, match=r"label_smoothing parameter"):
to_categorical(numpy.asarray([0, 1, 2, 3, 4]), label_smoothing=0.88)


Expand Down