-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathtest_run.py
More file actions
40 lines (28 loc) · 1.24 KB
/
test_run.py
File metadata and controls
40 lines (28 loc) · 1.24 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
import typing as t
import pytest
from pathlib import Path
from click.testing import Result
import time_machine
from tests.cli.test_cli import FREEZE_TIME
pytestmark = pytest.mark.slow
def test_run(jaffle_shop_duckdb: Path, invoke_cli: t.Callable[..., Result]):
result = invoke_cli(["run"])
assert result.exit_code == 0
assert not result.exception
assert "Model batches executed" in result.output
def test_run_with_selectors(jaffle_shop_duckdb: Path, invoke_cli: t.Callable[..., Result]):
with time_machine.travel(FREEZE_TIME):
# do an initial run to create the objects
# otherwise the selected subset may depend on something that hasnt been created
result = invoke_cli(["run"])
assert result.exit_code == 0
assert "main.orders" in result.output
result = invoke_cli(["run", "--select", "main.raw_customers+", "--exclude", "main.orders"])
assert result.exit_code == 0
assert not result.exception
assert "main.stg_customers" in result.output
assert "main.stg_orders" in result.output
assert "main.stg_payments" in result.output
assert "main.customers" in result.output
assert "main.orders" not in result.output
assert "Model batches executed" in result.output