Testing with Python, Pytest and Vim

  1. TDD with python, pytest and vim Setting up
  2. Getting Started
    1. pip install pytest
    2. pip install pytest-xdist
    3. If you are using Anaconda, pytest should already be installed
  3. Directory/Folder structure Create a tests folder in your project directory Test data for testing dataframes Name corresponding test files with a test_ infront
  4. Using VIM
    1. Open vim <filename> in the root directory
    2. Enter :vsplit <tests/filename> in vim’s console
    3. You will get a split window.
    4. Ctrl-wx to swap columns in the order of preference. I.e. code on left, test on right or vice versa
    5. Ctrl-ww to switch editing columns
  5. Using VIM – vsplit CODE TESTS
  6. Using VIM – vsplit Cursor Here shows where you are editing code testsCtrl-ww
  7. Pytest
    1. Run pytest -f -v in the root of your project directory
    2. Pytest will be watching for any changes in the code or tests.
    3. Once you save either file, it will re- run all tests automatically

My top 10 “It’s a great time to be a Software Developer” list

Accessibility to:

  1. Frameworks ( Django, Flask, Vue.js, React, Angular, MLFlow, WordPress )
  2. Documentation
  3. Community (includes Stackoverflow)
  4. Cloud platforms
  5. Compute Power (local machine)
  6. Python
  7. Docker
  8. Golang
  9. Scikit-learn, scikit-image
  10. Zsh




Computer Science. When I was younger, I only played games. I wasn’t intrigued by the machine itself, but I was pretty absorbed into the story. Some of the prominent games I loved

MAC/PC: Thexder, Digger, Hillsfar, Star Wars: – Dark Forces, Jedi Knight, Battlefront, X-Wing, TIE, X-Wing vs TIE – Mechwarrior, Diablo, WoW, Red Alert, Rainbow Six, Call of Duty, Company of Heros.

Sega: Thunderforce, Sonic The Hedgehog, Bareknuckles, Golden Axe

PS3: Metal Gear Solid, Colin McRae, Tekken 4

I wasn’t the usual inspired-by-game to go into Computer Science. I wanted to go into Chemical Engineering, but I changed my mind because I wanted to do something more ‘practical’. You see, I had decided computers are the way of the future and Skynet (Terminator) could be a reality. Sound shallow? Well, that was kind of the inspiration behind me embarking into the world of Computer Science.

In 1999, I started to learn C. A very very basic course on programming. What they didn’t teach me then was how to do that at home. We used Borland to write and compile our code. in 2001, I started learning more in Uni. We used Linux and learnt how to code in Python. This changed my entire thinking again. I was inspired by how easy it was to write a few lines of code to do some task.

In Uni we learnt and used C, Python, Java, Haskell, IDL and PHP. There was a project in all of these languages, no running away. By the end of the 4 years, I was pretty worn out and convinced programming wasn’t a career for me. Fast forward to 2011, about 6 years later. I needed to use some coding skills to automate a task at work. And from there, the hacking started again and it’s become rather addictive.

Here’s my story. 🙂

Next: It’s a great time to be a Software Developer