-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathtest_cli_chdir.py
More file actions
73 lines (61 loc) · 2.38 KB
/
test_cli_chdir.py
File metadata and controls
73 lines (61 loc) · 2.38 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import os
import platform
import tempfile
from datetime import timedelta
from pathlib import Path
import pytest
from feast.utils import _utc_now
from tests.utils.cli_repo_creator import CliRunner
# Skip all tests in this module on macOS CI due to subprocess timeout issues
# The CliRunner spawns subprocesses that can hang on macOS (e.g., registry-dump)
pytestmark = pytest.mark.skipif(
platform.system() == "Darwin" and os.environ.get("CI") == "true",
reason="Skip CLI tests on macOS CI due to subprocess timeout issues",
)
def test_cli_chdir() -> None:
"""
This test simply makes sure that you can run 'feast --chdir COMMAND'
to switch to a feature repository before running a COMMAND.
"""
runner = CliRunner()
with tempfile.TemporaryDirectory() as temp_dir:
# Make sure the path is absolute by resolving any symlinks
temp_path = Path(temp_dir).resolve()
result = runner.run(["init", "my_project"], cwd=temp_path)
repo_path = str(temp_path / "my_project" / "feature_repo")
assert result.returncode == 0
result = runner.run(["--chdir", repo_path, "apply"], cwd=temp_path)
assert result.returncode == 0
result = runner.run(["--chdir", repo_path, "entities", "list"], cwd=temp_path)
assert result.returncode == 0
result = runner.run(
["--chdir", repo_path, "feature-views", "list"], cwd=temp_path
)
assert result.returncode == 0
end_date = _utc_now()
start_date = end_date - timedelta(days=100)
result = runner.run(
[
"--chdir",
repo_path,
"materialize",
start_date.isoformat(),
end_date.isoformat(),
],
cwd=temp_path,
)
assert result.returncode == 0
result = runner.run(
[
"--chdir",
repo_path,
"materialize-incremental",
end_date.isoformat(),
],
cwd=temp_path,
)
assert result.returncode == 0
result = runner.run(["--chdir", repo_path, "registry-dump"], cwd=temp_path)
assert result.returncode == 0
result = runner.run(["--chdir", repo_path, "teardown"], cwd=temp_path)
assert result.returncode == 0