making pytests run reliably in vscode and powershell script to spin off a test file quickly

The concern is documenting ensuring pytest works as expected in vscode

1. requirements

  • there is 1 codeFile and 1 testFile
  • testFile is called *
  • test is called test_foo()
  • the only allowed separator on file (module) name is underscore _
  • no dots
  • no dashes
  • do not have code and tests in same file (I used to do that for katas, etc.)
  • you can use ptw for real-time testing there if needed

2. usage

  • have a custom keyboard shortcut for opening the test sidebar
  • CTRL + ALT + SHIFT + T
  • possibly also for running a particular test method / debug particular test method

3. creating code

  • lazy to keep creating an extra test file for each code file
  • now, I am ignoring the recommended folder structure at this moment

today I learnt… | as a support eng of the wonderful Snowplow Analytics, expect everything around modern (postmodern?) business intelligence

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store