Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip lines with #noqa comment #81

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests to cover noqa feature
  • Loading branch information
mnojek committed Jul 1, 2020
commit bcac5ebb9e7116948dbfdc628f11ed4dd2020801
40 changes: 40 additions & 0 deletions test_data/acceptance/noqa.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
*** Settings ***
Documentation Test cases with skip line indicator (# noqa)


*** Test Cases ***
Skip Tag With Spaces
[Documentation] Skip next line containing tag with spaces
[Tags] Tag With Spaces TagWithNoSpace # noqa
${foo} Set Variable some variable
${bar} Set Variable another variable

Do Not Skip Tag With Spaces
[Documentation] Report tag with spaces
[Tags] Tag With Spaces TagWithNoSpace
${foo} Set Variable some variable
${bar} Set Variable another variable

Skip This Test Case With Dot. #noqa
[Documentation] Do not report improper test case name
${foo} Set Variable some variable
${bar} Set Variable another variable

Do Not Skip This Test Case With Dot.
[Documentation] Report dot presence in test case name
${foo} Set Variable some variable
${bar} Set Variable another variable

Skip Very Long Line
[Documentation] Do not report very long line (+100 chars)
${long_variable} Set Variable This is a very long sentence with too many characters that should not be reported because of the 'noqa' comment at the end of this line # noqa and something else
${short_variable} Set Variable This is a short variable

Do Not Skip Very Long Line
[Documentation] Report very long line (+100 chars)
${long_variable} Set Variable This is a very long sentence with too many characters that will be reported because of lack of 'noqa' comment at the end of this line
${short_variable} Set Variable This is a short variable

Do Not Skip Line Because Of Improper Comment # noqaa
[Documentation] Improper comment should not make rflint omit the line
${var} Set Variable This test case contains only one test step
29 changes: 29 additions & 0 deletions tests/acceptance/noqa.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
*** Settings ***
| Documentation
| ... | Runs rflint against the rflint test suites and resource files
|
| Library | OperatingSystem
| Library | Process
| Resource | SharedKeywords.robot

*** Test Cases ***
| Run rflint and verify there are no errors or warnings
| | Run rf-lint with the following options:
| | ... | test_data/acceptance/noqa.robot
| |
| | @{messages}= | Split to lines | ${result.stdout}
| | ${warnings}= | Get match count | ${messages} | regexp=^W:
| | ${errors}= | Get match count | ${messages} | regexp=^E:
| |
| | Run keyword if | "${result.rc}" != "${1}" or ${warnings} != 3 or ${errors} != 1
| | ... | Fail | unexpectected errors or warnings: \n${result.stdout}\n${result.stderr}
| |
| | Output should contain
| | ... | W: 35, 100: Line is too long (exceeds 100 characters) (LineTooLong)
| | ... | E: 14, 0: space not allowed in tag name: 'Tag With Spaces' (TagWithSpaces)
| | ... | W: 23, 0: '.' in testcase name 'Do Not Skip This Test Case With Dot.' (PeriodInTestName)
| | ... | W: 38, 0: Too few steps (1) in test case (TooFewTestSteps)
| | Output should not contain
| | ... | W: 30, 100: Line is too long (exceeds 100 characters) (LineTooLong)
| | ... | E: 8, 0: space not allowed in tag name: 'Tag With Spaces' (TagWithSpaces)
| | ... | W: 18, 0: '.' in testcase name 'Skip This Test Case With Dot.' (PeriodInTestName)