File tree Expand file tree Collapse file tree 7 files changed +17
-8
lines changed
Expand file tree Collapse file tree 7 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -108,14 +108,16 @@ class BaseConfig:
108108 log_cache_events : Optional [bool ] = None
109109 defer : Optional [bool ] = None
110110 no_defer : Optional [bool ] = None
111- state : Optional [str ] = None
111+ state : Optional [Path ] = None
112112 threads : Optional [int ] = None
113113 compiled_target : Optional [Union ["os.PathLike[str]" , str ]] = None
114114
115115 def __post_init__ (self ):
116116 """Support dictionary args by casting them to str after setting."""
117117 if isinstance (self .vars , dict ):
118118 self .vars = json .dumps (self .vars )
119+ if isinstance (self .state , str ):
120+ self .state = Path (self .state )
119121
120122 @property
121123 def dbt_task (self ) -> BaseTask :
Original file line number Diff line number Diff line change 11"""Unit test module for DbtBuildOperator."""
22import json
3+ from pathlib import Path
34from unittest .mock import patch
45
56import pytest
@@ -62,7 +63,7 @@ def test_dbt_build_mocked_all_args():
6263 ]
6364 assert config .exclude == ["/path/to/model/to/exclude.sql" ]
6465 assert config .selector_name == ["a-selector" ]
65- assert config .state == "/path/to/state/"
66+ assert config .state == Path ( "/path/to/state/" )
6667 assert config .data is True
6768 assert config .schema is True
6869 assert config .show is True
Original file line number Diff line number Diff line change 11"""Unit test module for DbtCompileOperator."""
2+ from pathlib import Path
3+
24from dbt .contracts .results import RunStatus
35
46from airflow_dbt_python .hooks .dbt import CompileTaskConfig
@@ -48,7 +50,7 @@ def test_dbt_compile_mocked_all_args():
4850 ]
4951 assert config .exclude == ["/path/to/data/to/exclude.sql" ]
5052 assert config .selector_name == ["a-selector" ]
51- assert config .state == "/path/to/state/"
53+ assert config .state == Path ( "/path/to/state/" )
5254
5355
5456def test_dbt_compile_non_existent_model (profiles_file , dbt_project_file , model_files ):
Original file line number Diff line number Diff line change 11"""Unit test module for DbtRunOperator."""
22import json
3+ from pathlib import Path
34
45import pytest
56from dbt .contracts .results import RunStatus
@@ -54,7 +55,7 @@ def test_dbt_run_mocked_all_args():
5455 assert config .select == ["/path/to/model.sql" , "+/another/model.sql+2" ]
5556 assert config .exclude == ["/path/to/model/to/exclude.sql" ]
5657 assert config .selector_name == ["a-selector" ]
57- assert config .state == "/path/to/state/"
58+ assert config .state == Path ( "/path/to/state/" )
5859
5960
6061def test_dbt_run_non_existent_model (profiles_file , dbt_project_file , model_files ):
Original file line number Diff line number Diff line change 11"""Unit test module for DbtSeedOperator."""
22import json
3+ from pathlib import Path
34from unittest .mock import patch
45
56import pytest
@@ -55,7 +56,7 @@ def test_dbt_seed_mocked_all_args():
5556 assert config .show is True
5657 assert config .exclude == ["/path/to/data/to/exclude.csv" ]
5758 assert config .selector_name == ["a-selector" ]
58- assert config .state == "/path/to/state/"
59+ assert config .state == Path ( "/path/to/state/" )
5960
6061
6162def test_dbt_seed_non_existent_file (profiles_file , dbt_project_file , seed_files ):
Original file line number Diff line number Diff line change 11"""Unit test module for DbtSnapshotOperator."""
2- from unittest . mock import patch
2+ from pathlib import Path
33
44import pytest
55from dbt .contracts .results import RunStatus
@@ -41,7 +41,7 @@ def test_dbt_snapshot_mocked_all_args():
4141 assert config .select == ["/path/to/models" ]
4242 assert config .exclude == ["/path/to/data/to/exclude.sql" ]
4343 assert config .selector_name == ["a-selector" ]
44- assert config .state == "/path/to/state/"
44+ assert config .state == Path ( "/path/to/state/" )
4545
4646
4747def test_dbt_snapshot (profiles_file , dbt_project_file , snapshot_files ):
Original file line number Diff line number Diff line change 11"""Unit test module for DbtTestOperator."""
2+ from pathlib import Path
3+
24import pytest
35from dbt .contracts .results import TestStatus
46
@@ -55,7 +57,7 @@ def test_dbt_test_configuration_all_args():
5557 assert config .select == ["/path/to/models" ]
5658 assert config .exclude == ["/path/to/data/to/exclude.sql" ]
5759 assert config .selector_name == ["a-selector" ]
58- assert config .state == "/path/to/state/"
60+ assert config .state == Path ( "/path/to/state/" )
5961 assert config .no_defer is True
6062
6163
You can’t perform that action at this time.
0 commit comments