Loading build/lib/robot2doc/main.py +9 −6 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ def keywords_to_text(kws): ''' return "\n".join(map(keyword_to_line, kws)) def gen_test(suite, this_test, spec, sec, subsec, workspace, commit_id): def gen_test(suite, this_test, spec, sec, subsec, workspace, commit_id, sol, api): ''' Generate the Docx part for an individual test ''' Loading @@ -57,9 +57,9 @@ def gen_test(suite, this_test, spec, sec, subsec, workspace, commit_id): else: subsec = subsec + 1 spec.add_heading(str(this_test), DOC_TC_LEVEL, DOC_CLAUSE_LVL_1, sec, DOC_CLAUSE_LVL_3, subsec) tp.add_to_spec(spec, keywords_to_text(this_test.keywords), str(suite)+".robot", commit_id) tp.add_to_spec(spec, keywords_to_text(this_test.keywords), str(suite)+".robot", commit_id, sol, api) def gen_doc(src, doc_fn, doc_main_tit, commit_id): def gen_doc(src, doc_fn, doc_main_tit, commit_id, sol, api): ''' Converts a Robot test suite to a word document Loading Loading @@ -102,7 +102,7 @@ def gen_doc(src, doc_fn, doc_main_tit, commit_id): print(" Generating test suite: " + str(suite)) spec.add_sub_heading(str(suite), DOC_CLAUSE_LVL_1, sec, DOC_CLAUSE_LVL_3, subsec) for i in suite.tests: gen_test(suite, i, spec, sec, subsec, workspace, commit_id) gen_test(suite, i, spec, sec, subsec, workspace, commit_id, sol, api) if len(workspace.suites) == 0: sec = sec + 1 Loading @@ -110,7 +110,7 @@ def gen_doc(src, doc_fn, doc_main_tit, commit_id): suite = str(workspace) spec.add_sub_heading(suite, DOC_CLAUSE_LVL_1, sec, DOC_CLAUSE_LVL_3, subsec) for i in workspace.tests: gen_test(suite, i, spec, sec, subsec, workspace, commit_id) gen_test(suite, i, spec, sec, subsec, workspace, commit_id, sol, api) not QUIET and print("Saving to: " + doc_fn) not DRY_RUN and spec.save(doc_fn) Loading @@ -126,4 +126,7 @@ if __name__ == "__main__": DOC_FILENAME = sys.argv[2] if len(sys.argv) > 2 else DOC_FILENAME DOC_MAIN_TITLE = sys.argv[3] if len(sys.argv) > 3 else DOC_MAIN_TITLE COMMIT_ID = sys.argv[4] if len(sys.argv) > 4 else None gen_doc(FILE, DOC_FILENAME, DOC_MAIN_TITLE, COMMIT_ID) SOL = sys.argv[5] if len(sys.argv) > 5 else None API = sys.argv[6] if len(sys.argv) > 6 else None print( sys.argv[1:]) gen_doc(FILE, DOC_FILENAME, DOC_MAIN_TITLE, COMMIT_ID, SOL, API) build/lib/robot2doc/testpurpose.py +3 −4 Original line number Diff line number Diff line Loading @@ -34,14 +34,13 @@ class TP(): def __str__(self): return str(self.lines) def add_to_spec(self, spec : testspec.TestSpec, testbehaviour: str, robot_file : str, commit_id : str): def add_to_spec(self, spec : testspec.TestSpec, testbehaviour: str, robot_file : str, commit_id=None, sol=None, api=None): ''' Given a Test Spec, executes the addition of the this TP in the document. ''' spec.add_tp(self.tp_fields, testbehaviour) print("adding commit id: "+commit_id) if commit_id != None: spec.add_commit_url(commit_id, robot_file) spec.add_commit_url(robot_file, commit_id, sol, api) else: if config.GIT_COMMIT_PREFIX != "": spec.add_commit_url(config.GIT_COMMIT_PREFIX, robot_file) No newline at end of file spec.add_commit_url( robot_file, "", "", config.GIT_COMMIT_PREFIX) No newline at end of file build/lib/robot2doc/testspec.py +3 −2 Original line number Diff line number Diff line Loading @@ -68,12 +68,13 @@ class TestSpec(): TestSpec.cell_text_bold(hdr_cells[0]) TestSpec.cell_text_centered(hdr_cells[0]) def add_commit_url(self, commit : str, robot_file : str): def add_commit_url(self, robot_file : str, commit, sol, api): ''' Adds a note to the document containing the URL to the location of the file, according to the configured URL prefix configured. ''' self.doc.add_paragraph("Note: Robot code can be found at " + commit + robot_file) commit_string="https://forge.etsi.org/gitlab/nfv/api-tests/raw/"+commit+"/"+sol+"/"+api+"/"+robot_file self.doc.add_paragraph("Note: Robot code can be found at " + commit_string) def add_tp(self, fields, testbehaviour): table = self.doc.add_table(cols=2, rows=1) Loading dist/robot2doc-0.0.3-py3.7.egg +241 B (14.9 KiB) File changed.No diff preview for this file type. View original file View changed file execOverFolder.sh +11 −2 Original line number Diff line number Diff line #!/bin/bash EXCLUDE="" SOL="SOL00Y" COMMIT="" if [ "$1" != "" ]; then DIR=$1 if [ "$2" != "" ]; then Loading @@ -12,11 +14,18 @@ if [ "$1" != "" ]; then else echo "No configured commit id" fi if [ "$4" != "" ]; then SOL=$4 else echo "No configured commit id" fi API=$(basename $DIR) echo "api: $API" for file in $DIR/*.robot; do filename=$(basename "$file") if [[ $filename != *"$EXCLUDE"* ]]; then python robot2doc/main.py $file "${filename%.*}.docx" "${filename%.*}" $COMMIT python robot2doc/main.py $file "${filename%.*}.docx" "${filename%.*}" $COMMIT $SOL $API else echo "excluded file: $filename" fi Loading Loading
build/lib/robot2doc/main.py +9 −6 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ def keywords_to_text(kws): ''' return "\n".join(map(keyword_to_line, kws)) def gen_test(suite, this_test, spec, sec, subsec, workspace, commit_id): def gen_test(suite, this_test, spec, sec, subsec, workspace, commit_id, sol, api): ''' Generate the Docx part for an individual test ''' Loading @@ -57,9 +57,9 @@ def gen_test(suite, this_test, spec, sec, subsec, workspace, commit_id): else: subsec = subsec + 1 spec.add_heading(str(this_test), DOC_TC_LEVEL, DOC_CLAUSE_LVL_1, sec, DOC_CLAUSE_LVL_3, subsec) tp.add_to_spec(spec, keywords_to_text(this_test.keywords), str(suite)+".robot", commit_id) tp.add_to_spec(spec, keywords_to_text(this_test.keywords), str(suite)+".robot", commit_id, sol, api) def gen_doc(src, doc_fn, doc_main_tit, commit_id): def gen_doc(src, doc_fn, doc_main_tit, commit_id, sol, api): ''' Converts a Robot test suite to a word document Loading Loading @@ -102,7 +102,7 @@ def gen_doc(src, doc_fn, doc_main_tit, commit_id): print(" Generating test suite: " + str(suite)) spec.add_sub_heading(str(suite), DOC_CLAUSE_LVL_1, sec, DOC_CLAUSE_LVL_3, subsec) for i in suite.tests: gen_test(suite, i, spec, sec, subsec, workspace, commit_id) gen_test(suite, i, spec, sec, subsec, workspace, commit_id, sol, api) if len(workspace.suites) == 0: sec = sec + 1 Loading @@ -110,7 +110,7 @@ def gen_doc(src, doc_fn, doc_main_tit, commit_id): suite = str(workspace) spec.add_sub_heading(suite, DOC_CLAUSE_LVL_1, sec, DOC_CLAUSE_LVL_3, subsec) for i in workspace.tests: gen_test(suite, i, spec, sec, subsec, workspace, commit_id) gen_test(suite, i, spec, sec, subsec, workspace, commit_id, sol, api) not QUIET and print("Saving to: " + doc_fn) not DRY_RUN and spec.save(doc_fn) Loading @@ -126,4 +126,7 @@ if __name__ == "__main__": DOC_FILENAME = sys.argv[2] if len(sys.argv) > 2 else DOC_FILENAME DOC_MAIN_TITLE = sys.argv[3] if len(sys.argv) > 3 else DOC_MAIN_TITLE COMMIT_ID = sys.argv[4] if len(sys.argv) > 4 else None gen_doc(FILE, DOC_FILENAME, DOC_MAIN_TITLE, COMMIT_ID) SOL = sys.argv[5] if len(sys.argv) > 5 else None API = sys.argv[6] if len(sys.argv) > 6 else None print( sys.argv[1:]) gen_doc(FILE, DOC_FILENAME, DOC_MAIN_TITLE, COMMIT_ID, SOL, API)
build/lib/robot2doc/testpurpose.py +3 −4 Original line number Diff line number Diff line Loading @@ -34,14 +34,13 @@ class TP(): def __str__(self): return str(self.lines) def add_to_spec(self, spec : testspec.TestSpec, testbehaviour: str, robot_file : str, commit_id : str): def add_to_spec(self, spec : testspec.TestSpec, testbehaviour: str, robot_file : str, commit_id=None, sol=None, api=None): ''' Given a Test Spec, executes the addition of the this TP in the document. ''' spec.add_tp(self.tp_fields, testbehaviour) print("adding commit id: "+commit_id) if commit_id != None: spec.add_commit_url(commit_id, robot_file) spec.add_commit_url(robot_file, commit_id, sol, api) else: if config.GIT_COMMIT_PREFIX != "": spec.add_commit_url(config.GIT_COMMIT_PREFIX, robot_file) No newline at end of file spec.add_commit_url( robot_file, "", "", config.GIT_COMMIT_PREFIX) No newline at end of file
build/lib/robot2doc/testspec.py +3 −2 Original line number Diff line number Diff line Loading @@ -68,12 +68,13 @@ class TestSpec(): TestSpec.cell_text_bold(hdr_cells[0]) TestSpec.cell_text_centered(hdr_cells[0]) def add_commit_url(self, commit : str, robot_file : str): def add_commit_url(self, robot_file : str, commit, sol, api): ''' Adds a note to the document containing the URL to the location of the file, according to the configured URL prefix configured. ''' self.doc.add_paragraph("Note: Robot code can be found at " + commit + robot_file) commit_string="https://forge.etsi.org/gitlab/nfv/api-tests/raw/"+commit+"/"+sol+"/"+api+"/"+robot_file self.doc.add_paragraph("Note: Robot code can be found at " + commit_string) def add_tp(self, fields, testbehaviour): table = self.doc.add_table(cols=2, rows=1) Loading
dist/robot2doc-0.0.3-py3.7.egg +241 B (14.9 KiB) File changed.No diff preview for this file type. View original file View changed file
execOverFolder.sh +11 −2 Original line number Diff line number Diff line #!/bin/bash EXCLUDE="" SOL="SOL00Y" COMMIT="" if [ "$1" != "" ]; then DIR=$1 if [ "$2" != "" ]; then Loading @@ -12,11 +14,18 @@ if [ "$1" != "" ]; then else echo "No configured commit id" fi if [ "$4" != "" ]; then SOL=$4 else echo "No configured commit id" fi API=$(basename $DIR) echo "api: $API" for file in $DIR/*.robot; do filename=$(basename "$file") if [[ $filename != *"$EXCLUDE"* ]]; then python robot2doc/main.py $file "${filename%.*}.docx" "${filename%.*}" $COMMIT python robot2doc/main.py $file "${filename%.*}.docx" "${filename%.*}" $COMMIT $SOL $API else echo "excluded file: $filename" fi Loading