Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] Update --table-format arguments #3307

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions docs/manpage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1163,19 +1163,15 @@ Miscellaneous options

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

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

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

Note that the default ``outline`` format will not render correctly multi-line cells.
In this cases, prefer the ``grid`` or ``plain`` formats.
- ``plain``: Generate a plain table without any vertical lines allowing for easy ``grep``-ing
- ``pretty``: (default) Generate a pretty table

.. versionadded:: 4.7

Expand Down
93 changes: 60 additions & 33 deletions docs/tutorial.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ def main():
envvar='RFM_SYSTEM'
)
misc_options.add_argument(
'--table-format', choices=['csv', 'plain', 'outline', 'grid'],
'--table-format', choices=['csv', 'pretty', 'plain'],
help='Table formatting',
envvar='RFM_TABLE_FORMAT', configvar='general/table_format'
)
Expand Down
6 changes: 2 additions & 4 deletions reframe/frontend/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,8 @@ def table(self, data, **kwargs):

# Map our options to tabulate
if table_format == 'plain':
tablefmt = 'plain'
elif table_format == 'outline':
tablefmt = 'mixed_outline'
elif table_format == 'grid':
tablefmt = 'simple'
elif table_format == 'pretty':
tablefmt = 'mixed_grid'
else:
raise ValueError(f'invalid table format: {table_format}')
Expand Down
7 changes: 5 additions & 2 deletions reframe/frontend/reporting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,12 @@ def _group_testcases(testcases, groups, columns):

@time_function
def _aggregate_perf(grouped_testcases, aggr_fn, cols):
if runtime().get_option('general/0/table_format') == 'csv':
# Use a csv friendly delimiter
# Update delimiter for joining unique values based on the table format
table_foramt = runtime().get_option('general/0/table_format')
if table_foramt == 'csv':
delim = '|'
elif table_foramt == 'plain':
delim = ','
else:
delim = '\n'

Expand Down
2 changes: 1 addition & 1 deletion reframe/schemas/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@
"general/report_junit": null,
"general/resolve_module_conflicts": true,
"general/save_log_files": false,
"general/table_format": "outline",
"general/table_format": "pretty",
"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', 'grid', 'outline'])
@pytest.fixture(params=['csv', 'plain', 'pretty'])
def table_format(request):
return request.param

Expand Down
Loading