File: test_lazy_errors.py

package info (click to toggle)
python-parsl 2025.01.13%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,072 kB
  • sloc: python: 23,817; makefile: 349; sh: 276; ansic: 45
file content (28 lines) | stat: -rw-r--r-- 543 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pytest

import parsl
from parsl import python_app
from parsl.tests.configs.local_threads import fresh_config


@pytest.mark.local
def test_lazy_behavior():
    """Testing that lazy errors work"""

    config = fresh_config()
    parsl.load(config)

    @python_app
    def divide(a, b):
        return a / b

    futures = []
    for i in range(0, 10):
        futures.append(divide(10, 0))

    for f in futures:
        assert isinstance(f.exception(), ZeroDivisionError)
        assert f.done()

    parsl.dfk().cleanup()
    return