Skip to content

Commit

Permalink
Fixed plain formatting on scenario list (#2918)
Browse files Browse the repository at this point in the history
Fixed minor regression around printing list of scenarios.
  • Loading branch information
ssbarnea authored Oct 27, 2020
1 parent 01a22bc commit ef80ba4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ coverage.xml
pip-wheel-metadata
docs/docstree
.docker
molecule/
/molecule/
23 changes: 12 additions & 11 deletions lib/molecule/command/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def list(ctx, scenario_name, format): # pragma: no cover

headers = [util.title(name) for name in Status._fields]
if format == "simple" or format == "plain":
table_format = "simple"
table_format = format # "simple"

if format == "plain":
headers = []
table_format = format
Expand All @@ -132,16 +133,16 @@ def _print_tabulate_data(headers, data, table_format): # pragma: no cover
:param data: A list of tabular data to display.
:returns: None
"""
t = Table(box=box.MINIMAL)
for header in headers:
t.add_column(header)
for line in data:
console.print(line)
t.add_row(*line)
# console.print(headers)
# console.print(data)
# print(tabulate.tabulate(data, headers, tablefmt=table_format))
console.print(t)
if table_format == "plain":
for line in data:
console.print("\t".join(line))
else:
t = Table(box=box.MINIMAL)
for header in headers:
t.add_column(header)
for line in data:
t.add_row(*line)
console.print(t)


def _print_yaml_data(headers, data): # pragma: no cover
Expand Down
4 changes: 1 addition & 3 deletions lib/molecule/test/functional/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ def test_command_lint(scenario_to_test, with_scenario, scenario_name):
(
"driver/delegated",
"delegated",
"""
instance delegated ansible default
""".strip(),
"instance delegated ansible default",
),
],
indirect=["scenario_to_test", "driver_name"],
Expand Down

0 comments on commit ef80ba4

Please sign in to comment.