README.md 1.05 KB
Newer Older
Gabriel Couture's avatar
Gabriel Couture committed
1 2
# HowToTestBasic

Gabriel Couture's avatar
Gabriel Couture committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
Example of a basic python project with tests

## Setup.py

The `setup.py` file is where you setup your commands for the tests.


## Virtual environment

Having a virtual environment per projects is a great idea: 
https://realpython.com/python-virtual-environments-a-primer/

To create one, you first need `virtualenv`.
```bash
$ pip install virtualenv
```

After, you can create the virtual environnement in your project path.
Here, my virtual environment will be named `venv`, which is commun for local virtual environment.
```bash
$ virtualenv venv
```

Now, you should have a `venv/` directory in your project root path.
This directory contains the Python interpreter (with pip and other tools) at `./venv/bin/`.
You should use these executable for your project.

## requirements.txt

The `requirements.txt` file contains the needed libraries for the projects and the tests.
You need to have you virtual environment setup before generating the `requirements.txt`.

To generate the `requirements.txt`:
```bash
$ ./venv/bin/pip freeze > requirements.txt
```