File: test_exception.py

package info (click to toggle)
python-parsl 2025.12.01%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,112 kB
  • sloc: python: 24,369; makefile: 352; sh: 252; ansic: 45
file content (24 lines) | stat: -rw-r--r-- 489 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
import pytest

from parsl.app.app import python_app


class CustomException(Exception):
    pass


@python_app
def custom_exception():
    from parsl.tests.test_python_apps.test_exception import CustomException
    raise CustomException('foobar')


@pytest.mark.skipif(
    os.getenv('AUTOPKGTEST_TMP') != None,
    reason='fails to run in autopkgtest context'
)
def test_custom_exception():
    x = custom_exception()
    with pytest.raises(CustomException):
        x.result()