-
-
Notifications
You must be signed in to change notification settings - Fork 606
/
list_goals_integration_test.py
43 lines (36 loc) · 1.93 KB
/
list_goals_integration_test.py
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
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.testutil.pants_run_integration_test import PantsRunIntegrationTest
class TestListGoalsIntegration(PantsRunIntegrationTest):
def test_goals(self) -> None:
command = ["goals"]
pants_run = self.run_pants(command=command)
self.assert_success(pants_run)
assert "to get help for a particular goal" in pants_run.stdout_data
# Spot check a few core goals.
for goal in ["filedeps", "list", "roots", "validate"]:
assert goal in pants_run.stdout_data
def test_only_show_implemented_goals(self) -> None:
# Some core goals, such as `./pants test`, require downstream implementations to work
# properly. We should only show those goals when an implementation is provided.
goals_that_need_implementation = ["binary", "fmt", "lint", "run", "test"]
command = ["--pants-config-files=[]", "goals"]
not_implemented_run = self.run_pants(["--backend-packages=[]", *command,])
self.assert_success(not_implemented_run)
for goal in goals_that_need_implementation:
assert goal not in not_implemented_run.stdout_data
implemented_run = self.run_pants(
[
"--backend-packages=['pants.backend.python', 'pants.backend.python.lint.isort']",
*command,
],
)
self.assert_success(implemented_run)
for goal in goals_that_need_implementation:
assert goal in implemented_run.stdout_data
def test_ignored_args(self) -> None:
# Test that arguments (some of which used to be relevant) are ignored.
command = ["goals", "--all", "--graphviz", "--llama"]
pants_run = self.run_pants(command=command)
self.assert_success(pants_run)
assert "to get help for a particular goal" in pants_run.stdout_data