BangPypers The Bangalore Python User Group

May 2015 meetup report

The May BangPypers workshop happened at the RedHat office in Bannerghatta Road.

The workshop was focussed on writing unit test and functional tests in Python using unittest, py.test, mock. The presenter Kracekumar started the workshop by briefing basic command line program to create phonebook app. The application was designed to take the input from the command line and store in Sqlite3.

Topics covered where

  • How to use unittest module
  • How to use py.test and why py.test
  • Writing simple functions as testcases
  • Using different py.test command line features
  • Capturing stdout with py.test
  • Setting fixtures with py.test
  • Writing Test classes which py.test can pick
  • Using pytest.fixture
  • Running specific test module/class/function etc …
  • Writing setup and teardown in pytest style
  • How to mock expensive resources like network call, System Call.
  • Patching modules/functions/classes.
  • How to use Stubs/Fakes.

Content for the workshop is available in GitHub.

Kudos for participants making the workshop great, please take 10 seconds to fill the feedback.

Thanks for Red Hat for providing the space.