-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathconftest.py
More file actions
29 lines (20 loc) · 782 Bytes
/
conftest.py
File metadata and controls
29 lines (20 loc) · 782 Bytes
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
import typing as t
from pathlib import Path
import os
import functools
from click.testing import CliRunner, Result
import pytest
@pytest.fixture
def jaffle_shop_duckdb(copy_to_temp_path: t.Callable[..., t.List[Path]]) -> t.Iterable[Path]:
fixture_path = Path(__file__).parent / "fixtures" / "jaffle_shop_duckdb"
assert fixture_path.exists()
current_path = os.getcwd()
output_path = copy_to_temp_path(paths=fixture_path)[0]
# so that we can invoke commands from the perspective of a user that is alrady in the correct directory
os.chdir(output_path)
yield output_path
os.chdir(current_path)
@pytest.fixture
def invoke_cli() -> t.Callable[..., Result]:
from sqlmesh_dbt.cli import dbt
return functools.partial(CliRunner().invoke, dbt)