Commit 94225f4c authored by Michele Carignani's avatar Michele Carignani
Browse files

make linter happy

parent ed233e32
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -45,15 +45,15 @@ def gen_test(suite, this_test, spec, sec, subsec, workspace, commit_id, sol, api
    '''
    global DRY_RUN

    tp = TP(this_test.doc)
    ntp = TP(this_test.doc)

    log_line = ["TD", str(workspace), str(suite), str(this_test), tp.tp_id or "No ID" ]
    log_line = ["TD", str(workspace), str(suite), str(this_test), ntp.tp_id or "No ID"]
    not QUIET and print(",".join(log_line))

    if DRY_RUN:
        return
    if tp.tp_id != None:
        spec.add_heading(str(this_test), DOC_TC_LEVEL, tp.tp_id)
    if ntp.tp_id is not None:
        spec.add_heading(str(this_test), DOC_TC_LEVEL, ntp.tp_id)
    else:
        subsec = subsec + 1
        spec.add_heading(str(this_test), DOC_TC_LEVEL, DOC_CLAUSE_LVL_1, sec, DOC_CLAUSE_LVL_3, subsec)
@@ -88,7 +88,7 @@ def gen_doc(src, doc_fn, doc_main_tit, commit_id, sol, api):
        workspace = TestSuiteBuilder().build(src)
    except:
        print("Please check that first argument is a folder of Robot files or a single file.")
        exit(-1)
        sys.exit(-1)

    not QUIET and print("Loaded "+ str(len(workspace.suites)) + " test suites.")
    not QUIET and print("Loaded "+ str(len(workspace.tests)) + " tests.")
@@ -120,7 +120,7 @@ if __name__ == "__main__":

    if len(sys.argv) < 2:
        print("Usage: robot2doc <robot_file_or_dir> [<out_file> [spec_section_title]]")
        exit(-1)
        sys.exit(-1)

    FILE = sys.argv[1]
    DOC_FILENAME = sys.argv[2] if len(sys.argv) > 2 else DOC_FILENAME
+5 −4
Original line number Diff line number Diff line
#!/env/python

import docx
import config
import testspec

@@ -50,9 +49,11 @@ class TP():
        '''
        spec.add_tp(self.tp_fields, testbehaviour)

        if commit_id != None:
        configured_prefix = config.GIT_COMMIT_PREFIX

        if commit_id is not None:
            spec.add_commit_url(robot_file, commit_id, sol, api)
        else:    
            if  config.GIT_COMMIT_PREFIX != "":
                spec.add_commit_url(robot_file, config.GIT_COMMIT_PREFIX, "SOLAAA", "MyAPI")
            if  configured_prefix != "":
                spec.add_commit_url(robot_file, configured_prefix, "SOLAAA", "MyAPI")
+13 −15
Original line number Diff line number Diff line
@@ -44,22 +44,22 @@ def add_hyperlink(paragraph, url, text, color, underline):
    new_run = docx.oxml.shared.OxmlElement('w:r')

    # Create a new w:rPr element
    rPr = docx.oxml.shared.OxmlElement('w:rPr')
    rpr = docx.oxml.shared.OxmlElement('w:rPr')

    # Add color if it is given
    if not color is None:
        c = docx.oxml.shared.OxmlElement('w:color')
        c.set(docx.oxml.shared.qn('w:val'), color)
        rPr.append(c)
        col = docx.oxml.shared.OxmlElement('w:color')
        col.set(docx.oxml.shared.qn('w:val'), color)
        rpr.append(col)

    # Remove underlining if it is requested
    if not underline:
        u = docx.oxml.shared.OxmlElement('w:u')
        u.set(docx.oxml.shared.qn('w:val'), 'none')
        rPr.append(u)
        und = docx.oxml.shared.OxmlElement('w:u')
        und.set(docx.oxml.shared.qn('w:val'), 'none')
        rpr.append(und)

    # Join all the xml elements together add add the required text to the w:r element
    new_run.append(rPr)
    new_run.append(rpr)
    new_run.text = text
    hyperlink.append(new_run)

@@ -91,7 +91,7 @@ class TestSpec():
    @staticmethod
    def mk_ref(lv1, lv2="", lv3="", lv4="", lv5=""):
        secs = [str(x) for x in [lv1, lv2, lv3, lv4, lv5] if x != ""]
        return (".".join(secs))
        return ".".join(secs)

    @staticmethod
    def mk_heading(txt, sec, subsec1="", subsec2="", subsec3=""):
@@ -120,12 +120,10 @@ class TestSpec():
        Adds a note to the document containing the URL to the location of the
        file, according to the configured URL prefix configured.
        '''
        empty_par = self.doc.add_paragraph("")
        
        commit_url = commit+"/"+sol+"/"+api+"/"+robot_file
        note_par = self.doc.add_paragraph("NOTE: Robot code can be found at ")
        note_par.style = self.doc.styles["NO"]
        hyperlink = add_hyperlink(note_par, commit_url, commit_url, None, True)
        add_hyperlink(note_par, commit_url, commit_url, None, True)

    def add_tp(self, fields, testbehaviour):
        table = self.doc.add_table(cols=2, rows=1)
@@ -164,5 +162,5 @@ class TestSpec():
        @txt Title of the heading
        @sec Numer of the section of the heading
        '''
        self.doc.add_heading(TestSpec.mk_heading(txt, sec, subsec1, subsec2, subsec3), DOC_SUITE_LEVEL)
  
        tsh = TestSpec.mk_heading(txt, sec, subsec1, subsec2, subsec3)
        self.doc.add_heading(tsh, DOC_SUITE_LEVEL)
+1 −1

File changed.

Contains only whitespace changes.