Skip to content

Commit

Permalink
Adapt table formats so as to print multiline cells nicely
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarak committed Oct 14, 2024
1 parent 30b22d5 commit 3f8df61
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions docs/manpage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1166,15 +1166,19 @@ Miscellaneous options

This option can also be set using the :envvar:`RFM_SYSTEM` environment variable.

.. option:: --table-format=csv|plain|pretty
.. option:: --table-format=csv|plain|outline|grid

Set the formatting of tabular output printed by the options :option:`--performance-compare`, :option:`--performance-report` and the options controlling the stored sessions.

The acceptable values are the following:

- ``csv``: Generate CSV output
- ``grid``: Generate a table with grid lines
- ``outline``: (default) Generate a table with lines outlining the table and the header
- ``plain``: Generate a plain table without any lines
- ``pretty``: (default) Generate a pretty table

Note that the default ``outline`` format will not render correctly multi-line cells.
In this cases, prefer the ``grid`` or ``plain`` formats.

.. versionadded:: 4.7

Expand Down
2 changes: 1 addition & 1 deletion reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ def main():
envvar='RFM_SYSTEM'
)
misc_options.add_argument(
'--table-format', choices=['csv', 'plain', 'pretty'],
'--table-format', choices=['csv', 'plain', 'outline', 'grid'],
help='Table formatting',
envvar='RFM_TABLE_FORMAT', configvar='general/table_format'
)
Expand Down
4 changes: 3 additions & 1 deletion reframe/frontend/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,10 @@ def table(self, data, **kwargs):
# Map our options to tabulate
if table_format == 'plain':
tablefmt = 'plain'
elif table_format == 'pretty':
elif table_format == 'outline':
tablefmt = 'mixed_outline'
elif table_format == 'grid':
tablefmt = 'mixed_grid'
else:
raise ValueError(f'invalid table format: {table_format}')

Expand Down
2 changes: 1 addition & 1 deletion reframe/schemas/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@
"general/report_junit": null,
"general/resolve_module_conflicts": true,
"general/save_log_files": false,
"general/table_format": "pretty",
"general/table_format": "outline",
"general/target_systems": ["*"],
"general/timestamp_dirs": "%Y%m%dT%H%M%S%z",
"general/trap_job_errors": false,
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ def test_testlib_inherit_fixture_in_different_files(run_reframe):
assert 'FAILED' not in stdout


@pytest.fixture(params=['csv', 'plain', 'pretty'])
@pytest.fixture(params=['csv', 'plain', 'grid', 'outline'])
def table_format(request):
return request.param

Expand Down

0 comments on commit 3f8df61

Please sign in to comment.