Changeset 7e5cdea in rtems-tools for rtemstoolkit/textbox.py


Ignore:
Timestamp:
Nov 23, 2018, 4:02:52 AM (11 months ago)
Author:
Chris Johns <chrisj@…>
Branches:
e9f48e9face6c4dea62712d73b35412c0fe10332
Children:
f632bd8
Parents:
6fa0965
Message:

rtemstoolkit: Add unit testing for the python modules

  • Add support to run the unit tests for the rtemstoolkit python modules from waf. Enter './waf test' for the tests to be run on python2 and python3.
  • Update the importing of rtemstoolkit modules to the standard method which works on python2 and python3.
  • Update the README.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtemstoolkit/textbox.py

    r6fa0965 r7e5cdea  
    4040import os
    4141
    42 #
    43 # Support to handle use in a package and as a unit test.
    44 # If there is a better way to let us know.
    45 #
    46 try:
    47     from . import error
    48 except (ValueError, SystemError):
    49     import error
     42from rtemstoolkit import error
    5043
    5144def line(cols, line = '-', marker = '|', indent = 0, linesep = os.linesep):
    5245    s = ' ' * indent + marker
    5346    for c in cols:
    54         s += line[0] * (c - 1) + marker
     47        s += line[0] * int((c - 1)) + marker
    5548    return s + linesep
    5649
     
    6558        else:
    6659            m = '|'
    67         s += '%-*s%s' % (cols[c] - 1, str(data[c]), m)
     60        s += '%-*s%s' % (int(cols[c] - 1), str(data[c]), m)
    6861    return s + linesep
    6962
     
    7164    per_col = width / cols
    7265    columns = [per_col for c in range(0, cols)]
    73     for remainder in range(0, width - (per_col * cols)):
     66    for remainder in range(0, int(width - (per_col * cols))):
    7467        if remainder % 2 == 0:
    7568            columns[remainder] += 1
Note: See TracChangeset for help on using the changeset viewer.