- Create the venv
$$ python3 -m venv venv_name
- Activate the env
$$ source path/venv/bin/activate
- Install pipenv
$$ pip3 install pipenv
- Use pipenv to install packages
$$ pipenv install pytest
- VS Code configuration
- unittest
- doctest
- pytest
-
unittest
- Add the main() function than execute the file
$$ python demo/test_program_unittest.py [-v]
- Execute the file with the command
$$ python -m unittest demo/test_program_unittest.py [-v]
- Add the main() function than execute the file
-
doctest
- Execute the file with the command
$$ python demo/doctest_example.py [-v]
- Execute the file with the command
-
pytest
- Execute the file with the command
$$ pytest demo/test_program_pytest.py [-v]
- Execute the file with the command
- Install coverage
$$ pipenv install coverage
- Execute
$$ coverage run -m unittest demo/test_program_unittest.py [-v]
- Create an HTML page of the coverage with the command
$$ coverage html
- Install coverage
$$ pipenv install pytest-html
- Execute
$$ pytest demo/test_program_pytest.py [-v] --html=path/file.html