File: test_serialization_fail.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 (33 lines) | stat: -rw-r--r-- 647 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
29
30
31
32
33
import pytest

from parsl import python_app
from parsl.serialize.errors import SerializationError
from parsl.tests.configs.htex_local import fresh_config


def local_config():
    config = fresh_config()
    config.retries = 2
    return config


@python_app
def fail_pickling(x):
    return next(x)


def generator():
    num = 0
    while True:
        yield num
        num += 1


@pytest.mark.local
def test_serialization_error():

    gen = generator()
    x = fail_pickling(gen)

    assert x.exception() is not None, "Should have got an exception, actually got: " + repr(x.result())
    assert isinstance(x.exception(), SerializationError)