Skip to content

Commit

Permalink
Fix tests for exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
fraimondo committed Jan 23, 2025
1 parent 82bff5e commit ff89587
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions joblib_htcondor/tests/test_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import logging
import socket
from concurrent import futures

Check failure on line 8 in joblib_htcondor/tests/test_runtime.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (F401)

joblib_htcondor/tests/test_runtime.py:8:24: F401 `concurrent.futures` imported but unused

Check failure on line 8 in joblib_htcondor/tests/test_runtime.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (F401)

joblib_htcondor/tests/test_runtime.py:8:24: F401 `concurrent.futures` imported but unused

import pytest
from joblib import Parallel, delayed, parallel_config
Expand Down Expand Up @@ -32,8 +33,6 @@ def test_normal() -> None:
assert out == [-1, -2, -3, -4, -5]




def test_exception() -> None:
"""Test running with an exception."""
def neg_with_exception(a: int) -> int:
Expand Down Expand Up @@ -68,6 +67,5 @@ def neg_with_exception(a: int) -> int:
verbose=1000,
worker_log_level=logging.INFO,
):
out = Parallel()(delayed(neg_with_exception)(i + 1) for i in range(5))

assert out == [-1, -2, -3, -4, -5]
with pytest.raises(ValueError, match="This is an exception"):
Parallel()(delayed(neg_with_exception)(i + 1) for i in range(5))

0 comments on commit ff89587

Please sign in to comment.