Questions, answers, and comments from our collaborative document

  • What did you work on in the past week?
    • Writing unit tests for (my own) older code.
  • Suggestion for next week:
    • byobu, tmux (screen) how to use a shell (connected via ssh) properly
      • followed-up here: https://github.com/ResearchSoftwareHour/rsh-notes/issues/36

Testing

  • testing private methods:
    • depending on the language (Java) you can use introspection to make it non-private
    • in C++ maybe use friend and a second class to make stuff public just for the test
    • in Python, there should not be private methods, simply call the _foo(), __bar()
  • Redirecting print output in Python:
    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!