RSH 6: Testing
If it's not tested, you can't trust it
Video
Collaborative notes taken during the session
Testing
import io
import contextlib
my_io_buffer = io.StringIO()
with contextlib.redirect_stdout(my_io_buffer):
import my_chatty_module # all output is now in the io buffer
print('abcd') # abcd is now in the io buffer
-
[name=Radovan] Nice!
-
pytest has capture output: https://docs.pytest.org/en/latest/capture.html
-
Automated testing
- Travis validator: https://config.travis-ci.com/explore
-
[name=Ashwin] What you describe today is "example-based testing", and also manual "mutation testing".
- Property testing (for eg. in Python with
hypothesis
)
- todo: let's have a session where we talk about all the different types of tests
- followed-up here: https://github.com/ResearchSoftwareHour/rsh-notes/issues/37
-
who pays for the GitHub Actions CPU power? Is there a limit on seconds per run?
- GitHub/Microsoft itself. Public repositories free, private have some limits: https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits
History cleanup
-
To rebase / fixup etc. ideally you should work on a local branch, right? i.e. you should not have pushed the commits.
- Ideally on a local branch but sometimes I do cleanup pushed commits if it is clear to me that nobody depends
on these commits and clear to everybody that these can change.
-
Difference between git push --force
and git push --force-with-lease
?
- Never heard of it before, but this looks promising: https://stackoverflow.com/questions/52823692/git-push-force-with-lease-vs-force
-
Thank you :-)
Feedback
- maybe try to mix and make theme based sessions?
- I learned a few useful tricks today, thanks :+1:
- I would also like to see both, "scientific" and "tool" topics! :) Thank you very much! You deserve much more attention/viewers!