[V1] framework/*: Replace framework texttable with third party library

Dong, JunX junx.dong at intel.com
Wed Mar 30 11:11:50 CEST 2022


> -----Original Message-----
> From: Juraj Linkeš <juraj.linkes at pantheon.tech>
> Sent: Wednesday, March 30, 2022 4:03 PM
> To: Dong, JunX <junx.dong at intel.com>; dts at dpdk.org
> Cc: Tu, Lijuan <lijuan.tu at intel.com>; Sun, QingX <qingx.sun at intel.com>
> Subject: RE: [V1] framework/*: Replace framework texttable with third party
> libary
> > -----Original Message-----
> > From: Jun Dong <junx.dong at intel.com>
> > Sent: Wednesday, March 30, 2022 9:14 AM
> > To: dts at dpdk.org
> > Cc: lijuan.tu at intel.com; qingx.sun at intel.com; junx.dong at intel.com
> > Subject: [V1] framework/*: Replace framework texttable with third
> > party libary
> >
> > Signed-off-by: Jun Dong <junx.dong at intel.com>
> > ---
> >  framework/dts.py         |   1 -
> >  framework/test_result.py |   5 +-
> >  framework/texttable.py   | 645 ---------------------------------------
> >  requirements.txt         |   3 +-
> >  tests/perf_test_base.py  |   5 +-
> >  5 files changed, 8 insertions(+), 651 deletions(-)  delete mode
> > 100644 framework/texttable.py
> >
> 
> > diff --git a/framework/test_result.py b/framework/test_result.py index
> > 0231e769..abf8edb9 100644
> > --- a/framework/test_result.py
> > +++ b/framework/test_result.py
> > @@ -32,7 +32,6 @@
> >  """
> >  Generic result container and reporters  """
> > -import framework.texttable as texttable  # text format
> >
> >
> >  class Result(object):
> > @@ -445,9 +444,11 @@ class ResultTable(object):
> >          rt.add_row(row)
> >          rt.table_print()
> >          """
> > +        from texttable import Texttable
> > +
> >          self.results_table_rows = []
> >          self.results_table_rows.append([])
> > -        self.table = texttable.Texttable(max_width=150)
> > +        self.table = Texttable(max_width=150)
> >          self.results_table_header = header
> >          self.logger = None
> >          self.rst = None
> 
> Is there a reason for moving the import statement? I'd prefer to have it at
> the beginning of the file.
  
   Hi, Juraj Linkeš, thanks for your comments.
   Sometimes, the trex will be used When execute performance suite,
   And trex also used texttable that comes from  itself.
   But, the third party library texttable wasn't full compatible with the trex's version,
   If import texttable in global in DTS framework will effect trex which not import again,
  So, import texttable locally in the DTS framework.
   
> > diff --git a/tests/perf_test_base.py b/tests/perf_test_base.py index
> > 0666f3bf..82ae74f4 100644
> > --- a/tests/perf_test_base.py
> > +++ b/tests/perf_test_base.py
> > @@ -44,7 +44,6 @@ from pprint import pformat
> >
> >  import numpy as np
> >
> > -import framework.texttable as texttable  import framework.utils as
> > utils  from framework.config import SuiteConf  from
> > framework.exception import VerifyFailure @@ -1039,11 +1038,13 @@ class
> PerfTestBase(object):
> >          return mode_name
> >
> >      def __display_suite_result(self, data):
> > +        from texttable import Texttable
> > +
> >          values = data.get("values")
> >          title = data.get("title")
> >          max_length = sum([len(item) + 5 for item in title])
> >          self.result_table_create(title)
> > -        self._result_table.table = texttable.Texttable(max_width=max_length)
> > +        self._result_table.table = Texttable(max_width=max_length)
> >          for value in values:
> >              self.result_table_add(value)
> >          self.result_table_print()
> > --
> > 2.33.1.windows.1
> >
> 
> Same here.



More information about the dts mailing list