-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest_exceptions.py
More file actions
57 lines (52 loc) · 1.28 KB
/
test_exceptions.py
File metadata and controls
57 lines (52 loc) · 1.28 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import pickle
import pytest
from selene_sim.exceptions import (
SeleneBuildError,
SeleneStartupError,
SeleneRuntimeError,
SelenePanicError,
)
@pytest.mark.parametrize(
"error_class, kwargs",
[
(
SeleneBuildError,
{
"message": "Exception",
"stdout": "stdout",
"stderr": "stderr",
},
),
(
SeleneStartupError,
{
"message": "Exception",
"stdout": "stdout",
"stderr": "stderr",
},
),
(
SeleneRuntimeError,
{
"message": "Exception",
"stdout": "stdout",
"stderr": "stderr",
},
),
(
SelenePanicError,
{
"message": "Exception",
"code": "foo",
"stdout": "stdout",
"stderr": "stderr",
},
),
],
)
def test_pickle_and_unpickle_selene_startup_error(error_class, kwargs):
error = error_class(**kwargs)
unpickled = pickle.loads(pickle.dumps(error))
assert isinstance(unpickled, error_class)
for k, v in kwargs.items():
assert getattr(unpickled, k) == v