-
Notifications
You must be signed in to change notification settings - Fork 130
Hk improve tests #360
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
Hk improve tests #360
Conversation
When forgetting to install the protobuf compiler, an error message is shown which had a missing space between two words.
There is no reason to traverse the file line by line if all we care about is the last character. This also uses unittests subTest to show the file which fails the test.
When one file is failing, due to the fact that all tests contain for loops, the other failures are swallowed because python stops running the test on the first assertion. With subTest one can introduce a subcontext which allows showing all of the failed files as well a diagnostic as to which file failed.
Python provides mechanisms for that, no reason to manually track a count.
The globs where repeated a whole bunch of times which is both information duplication as well as unneccessary work.
There is no reason to guard the assertions in the conditional.
| for file in DOC_FILES: | ||
| with open(file, "rt") as fin, self.subTest(file=file): | ||
| for i, line in enumerate(fin, start=1): | ||
| self.assertNotRegex(line, r"([\s>]|^)#\w(\S)*", file + " in line " + str(i) + ": not permitted hash found.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FAIL: test_hash (test_doxygen_output.TestDoxygenOutput) (file='doc/html/windows.html')
Test case is checking if there are illegal hash chars in the documentation. -> doxygen link not found.
----------------------------------------------------------------------
Traceback (most recent call last):
File "open-simulation-interface/tests/test_doxygen_output.py", line 17, in test_hash
self.assertNotRegex(line, r"([\s>]|^)#\w(\S)*", file + " in line " + str(i) + ": not permitted hash found.")
AssertionError: Regex matched: '#lol' matches '([\\s>]|^)#\\w(\\S)*' in '#lol\n' : doc/html/windows.html in line 5: not permitted hash found.
I think the assertion message is good enough so that we dont need to manually add the offending section again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may be right!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
63dfbd2 to
1a0dc73
Compare
Python2 is end of life in just a few days and should not be recommended anymore.
The error message is quite good when using the provided regex matcher.
1a0dc73 to
627c7a9
Compare
| on: | ||
| branch: master | ||
| on: | ||
| branch: master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this was indented incorrectly which caused PRs to deploy the docs :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a new maintainer 💃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True thanks for finding :)
vkresch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reference to a related issue in the repository
None - These are out of context quality of life improvements in the automated test suite
This PR contains #359 except from the branch pushed to the osi organization instead of to my fork. Maybe travis isn't configured to build fork PRs (I think this is the default due to potentially leaking env secrets into forks.)
Add a description
I saw some long-hanging fruit in improving these tests. I hope the commit messages do
well enough to explain the change/intention behind it. If not, feel free to comment on details :)
This PR switches the build to python3. Python2 is EOL in just a few days so I think it is reasonable to makes this switch (let me know if there are reasons not to do this!).
Check the checklist