From 3f8df6126aad2c692994bbfbf51f7451604f40b6 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Mon, 14 Oct 2024 14:54:49 +0200 Subject: [PATCH] Adapt table formats so as to print multiline cells nicely --- docs/manpage.rst | 8 ++++++-- reframe/frontend/cli.py | 2 +- reframe/frontend/printer.py | 4 +++- reframe/schemas/config.json | 2 +- unittests/test_cli.py | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/manpage.rst b/docs/manpage.rst index 0bd4ba72e..162f96290 100644 --- a/docs/manpage.rst +++ b/docs/manpage.rst @@ -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 diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index 2e1a7d966..9bc78d926 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -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' ) diff --git a/reframe/frontend/printer.py b/reframe/frontend/printer.py index 0f9a1b6e3..d1324e1cf 100644 --- a/reframe/frontend/printer.py +++ b/reframe/frontend/printer.py @@ -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}') diff --git a/reframe/schemas/config.json b/reframe/schemas/config.json index a3b9eccd1..b8a7f2fde 100644 --- a/reframe/schemas/config.json +++ b/reframe/schemas/config.json @@ -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, diff --git a/unittests/test_cli.py b/unittests/test_cli.py index d5afe94cd..8063f8c70 100644 --- a/unittests/test_cli.py +++ b/unittests/test_cli.py @@ -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