Skip to content

Commit

Permalink
fix generation of measurement table (#380)
Browse files Browse the repository at this point in the history
Previously, when printing the measurements result table, one would initialize
the `t.field_names` field to `[""]`. Later on `t.field_names` would be
overwritten by the actual table column names, namely the servers under test.

Each time one sets `t.field_names`, the `field_names` setter logic would run.

https://github.com/jazzband/prettytable/blob/1f156f8f82a8442fcec332018de0d66fa308acce/src/prettytable/prettytable.py#L605-L608

Among this is `validate_field_names`, which asserts that the number of fields
from the second assignment equals the number of fields of the first assignment.

https://github.com/jazzband/prettytable/blob/1f156f8f82a8442fcec332018de0d66fa308acce/src/prettytable/prettytable.py#L411-L421

Initializing `t.field_names` with `[""]` is not neccessary. Thus, to prevent the
above assertion from failing, this commit removes the initialization, fully
depending on the actual assignment with the name of the servers under test.
  • Loading branch information
mxinden authored Apr 9, 2024
1 parent 4be6491 commit 2a2534a
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion interop.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ def get_letters(result):
t = prettytable.PrettyTable()
t.hrules = prettytable.ALL
t.vrules = prettytable.ALL
t.field_names = [""]
rows = {}
columns = {}
for client, server in self._client_server_pairs:
Expand Down

0 comments on commit 2a2534a

Please sign in to comment.