pytest (4)


Django TDD setup

Unit Tests Setup 1. Create virtual env. pipenv shell 2. Install django pipenv install django 3. Create django project. django-admin startproject tested 4. Create .gitignore file touch .gitignore settings setup a settings file for tests. This will use an in-memory sqlite DB (sqlite3). This is good because we don’t want a PG or MySQL db […]




Using Pytest with Django and Django Rest Framework

This article is inspired by article here. What is Pytest Pytest is testing framework for Python. Very popular with Django. Killer feature : Fixtures Fixtures are the killer feature of Pytest. Fixtures are functions that run before and after each test, like setUp and tearDown in unitest and labelled pytest killer feature. Fixtures are used […]




Steps for new Python library or package

Here are the steps. Create repo on github with license, gitignore and readme stubs. Clone the repo in the work area. Lets say, my new library is called new-library new-library is the repo name. Inside the cloned repo, create virtual env by running: pipenv install –python 3.8 Above step creates a virtualenv using python 3.8 […]




Django Rest Framework project setup template

Ian Schneider This is a list of what I do when I setup a new DRF project. I am assuming that pipenv is already installed. Also, assuming that Python 3.5+ already installed in the base environment. For those in Python<3.5, please refer here for options. create new environment: pipenv shell pipenv install django djangorestframework markdown […]