|
3 | 3 | from pathlib import Path |
4 | 4 | from textwrap import dedent |
5 | 5 |
|
| 6 | +import assertpy |
| 7 | + |
6 | 8 | from feast.feature_store import FeatureStore |
7 | 9 | from tests.cli_utils import CliRunner |
8 | 10 | from tests.online_read_write_test import basic_rw_test |
@@ -39,39 +41,39 @@ def test_workflow() -> None: |
39 | 41 | ) |
40 | 42 |
|
41 | 43 | result = runner.run(["apply"], cwd=repo_path) |
42 | | - assert result.returncode == 0 |
| 44 | + assertpy.assert_that(result.returncode).is_equal_to(0) |
43 | 45 |
|
44 | 46 | # entity & feature view list commands should succeed |
45 | 47 | result = runner.run(["entities", "list"], cwd=repo_path) |
46 | | - assert result.returncode == 0 |
| 48 | + assertpy.assert_that(result.returncode).is_equal_to(0) |
47 | 49 | result = runner.run(["feature-views", "list"], cwd=repo_path) |
48 | | - assert result.returncode == 0 |
| 50 | + assertpy.assert_that(result.returncode).is_equal_to(0) |
49 | 51 |
|
50 | 52 | # entity & feature view describe commands should succeed when objects exist |
51 | 53 | result = runner.run(["entities", "describe", "driver"], cwd=repo_path) |
52 | | - assert result.returncode == 0 |
| 54 | + assertpy.assert_that(result.returncode).is_equal_to(0) |
53 | 55 | result = runner.run( |
54 | 56 | ["feature-views", "describe", "driver_locations"], cwd=repo_path |
55 | 57 | ) |
56 | | - assert result.returncode == 0 |
| 58 | + assertpy.assert_that(result.returncode).is_equal_to(0) |
57 | 59 |
|
58 | 60 | # entity & feature view describe commands should fail when objects don't exist |
59 | 61 | result = runner.run(["entities", "describe", "foo"], cwd=repo_path) |
60 | | - assert result.returncode == 1 |
| 62 | + assertpy.assert_that(result.returncode).is_equal_to(1) |
61 | 63 | result = runner.run(["feature-views", "describe", "foo"], cwd=repo_path) |
62 | | - assert result.returncode == 1 |
| 64 | + assertpy.assert_that(result.returncode).is_equal_to(1) |
63 | 65 |
|
64 | 66 | # Doing another apply should be a no op, and should not cause errors |
65 | 67 | result = runner.run(["apply"], cwd=repo_path) |
66 | | - assert result.returncode == 0 |
| 68 | + assertpy.assert_that(result.returncode).is_equal_to(0) |
67 | 69 |
|
68 | 70 | basic_rw_test( |
69 | 71 | FeatureStore(repo_path=str(repo_path), config=None), |
70 | 72 | view_name="driver_locations", |
71 | 73 | ) |
72 | 74 |
|
73 | 75 | result = runner.run(["teardown"], cwd=repo_path) |
74 | | - assert result.returncode == 0 |
| 76 | + assertpy.assert_that(result.returncode).is_equal_to(0) |
75 | 77 |
|
76 | 78 |
|
77 | 79 | def test_non_local_feature_repo() -> None: |
@@ -104,13 +106,13 @@ def test_non_local_feature_repo() -> None: |
104 | 106 | ) |
105 | 107 |
|
106 | 108 | result = runner.run(["apply"], cwd=repo_path) |
107 | | - assert result.returncode == 0 |
| 109 | + assertpy.assert_that(result.returncode).is_equal_to(0) |
108 | 110 |
|
109 | 111 | fs = FeatureStore(repo_path=str(repo_path)) |
110 | | - assert len(fs.list_feature_views()) == 3 |
| 112 | + assertpy.assert_that(fs.list_feature_views()).is_length(3) |
111 | 113 |
|
112 | 114 | result = runner.run(["teardown"], cwd=repo_path) |
113 | | - assert result.returncode == 0 |
| 115 | + assertpy.assert_that(result.returncode).is_equal_to(0) |
114 | 116 |
|
115 | 117 |
|
116 | 118 | @contextmanager |
@@ -150,19 +152,23 @@ def test_3rd_party_providers() -> None: |
150 | 152 | # Check with incorrect built-in provider name (no dots) |
151 | 153 | with setup_third_party_provider_repo("feast123") as repo_path: |
152 | 154 | return_code, output = runner.run_with_output(["apply"], cwd=repo_path) |
153 | | - assert return_code == 1 |
154 | | - assert b"Provider 'feast123' is not implemented" in output |
| 155 | + assertpy.assert_that(return_code).is_equal_to(1) |
| 156 | + assertpy.assert_that(output).contains(b"Provider 'feast123' is not implemented") |
155 | 157 | # Check with incorrect third-party provider name (with dots) |
156 | 158 | with setup_third_party_provider_repo("feast_foo.provider") as repo_path: |
157 | 159 | return_code, output = runner.run_with_output(["apply"], cwd=repo_path) |
158 | | - assert return_code == 1 |
159 | | - assert b"Could not import provider module 'feast_foo'" in output |
| 160 | + assertpy.assert_that(return_code).is_equal_to(1) |
| 161 | + assertpy.assert_that(output).contains( |
| 162 | + b"Could not import provider module 'feast_foo'" |
| 163 | + ) |
160 | 164 | # Check with incorrect third-party provider name (with dots) |
161 | | - with setup_third_party_provider_repo("foo.provider") as repo_path: |
| 165 | + with setup_third_party_provider_repo("foo.FooProvider") as repo_path: |
162 | 166 | return_code, output = runner.run_with_output(["apply"], cwd=repo_path) |
163 | | - assert return_code == 1 |
164 | | - assert b"Could not import provider 'provider' from module 'foo'" in output |
| 167 | + assertpy.assert_that(return_code).is_equal_to(1) |
| 168 | + assertpy.assert_that(output).contains( |
| 169 | + b"Could not import provider 'FooProvider' from module 'foo'" |
| 170 | + ) |
165 | 171 | # Check with correct third-party provider name |
166 | 172 | with setup_third_party_provider_repo("foo.provider.FooProvider") as repo_path: |
167 | 173 | return_code, output = runner.run_with_output(["apply"], cwd=repo_path) |
168 | | - assert return_code == 0 |
| 174 | + assertpy.assert_that(return_code).is_equal_to(0) |
0 commit comments