Skip to content

Commit 61e1d11

Browse files
committed
Updated error messages to look for in activitysim.core tests
1 parent e31a231 commit 61e1d11

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

activitysim/core/test/test_pipeline.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import tables
1010

1111
from activitysim.core import workflow
12+
from activitysim.core.exceptions import CheckpointNameNotFoundError
1213
from activitysim.core.test.extensions import steps
1314

1415
# set the max households for all tests (this is to limit memory use on travis)
@@ -70,17 +71,17 @@ def test_pipeline_run(state):
7071
state.checkpoint.load_dataframe("table1", checkpoint_name="step3")
7172

7273
# try to get a table from a step before it was checkpointed
73-
with pytest.raises(RuntimeError) as excinfo:
74+
with pytest.raises(CheckpointNameNotFoundError) as excinfo:
7475
state.checkpoint.load_dataframe("table2", checkpoint_name="step1")
7576
assert "not in checkpoint 'step1'" in str(excinfo.value)
7677

7778
# try to get a non-existant table
78-
with pytest.raises(RuntimeError) as excinfo:
79+
with pytest.raises(CheckpointNameNotFoundError) as excinfo:
7980
state.checkpoint.load_dataframe("bogus")
8081
assert "never checkpointed" in str(excinfo.value)
8182

8283
# try to get an existing table from a non-existant checkpoint
83-
with pytest.raises(RuntimeError) as excinfo:
84+
with pytest.raises(CheckpointNameNotFoundError) as excinfo:
8485
state.checkpoint.load_dataframe("table1", checkpoint_name="bogus")
8586
assert "not in checkpoints" in str(excinfo.value)
8687

@@ -111,12 +112,12 @@ def test_pipeline_checkpoint_drop(state):
111112

112113
state.checkpoint.load_dataframe("table1")
113114

114-
with pytest.raises(RuntimeError) as excinfo:
115+
with pytest.raises(CheckpointNameNotFoundError) as excinfo:
115116
state.checkpoint.load_dataframe("table2")
116117
# assert "never checkpointed" in str(excinfo.value)
117118

118119
# can't get a dropped table from current checkpoint
119-
with pytest.raises(RuntimeError) as excinfo:
120+
with pytest.raises(CheckpointNameNotFoundError) as excinfo:
120121
state.checkpoint.load_dataframe("table3")
121122
# assert "was dropped" in str(excinfo.value)
122123

activitysim/core/test/test_random.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pytest
99

1010
from activitysim.core import random
11+
from activitysim.core.exceptions import DuplicateLoadableObjectError
1112

1213

1314
def test_basic():
@@ -27,7 +28,7 @@ def test_basic():
2728
assert "Arrays are not almost equal" in str(excinfo.value)
2829

2930
# second call should return something different
30-
with pytest.raises(RuntimeError) as excinfo:
31+
with pytest.raises(DuplicateLoadableObjectError) as excinfo:
3132
rng.set_base_seed(1)
3233
assert "call set_base_seed before the first step" in str(excinfo.value)
3334

0 commit comments

Comments
 (0)