Skip to content

Data Structures, algorithms and design patterns in Python with tests and documentation

Notifications You must be signed in to change notification settings

andreafiori/python-coding-dojo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python problems and solutions

Build Status

Generic problems with solutions and tests in Python.

Requirements

Tests

Install pytest:

pip install pytest

Run all tests:

pytest

Stop pytest after first failure

pytest -x

Run single unit test:

pytest <path_to_file.py>

Es:

pytest tests/algorithms/strings/test_stringutil.py

Generate code coverage

Install coverage:

pip install coverage

Show coverage:

coverage run --source=src/ -m pytest

Using pytest-cov. Install it:

pip install pytest-cov 

Show coverage

pytest --cov=src tests/

Generate HTML reports:

coverage run --source=src/ -m pytest
coverage html

Coverage has a problem: it doesn't generate a report for files without test so I use pytest-cov:

pytest --cov=src tests/ --cov-report=html

Running pylint:

pylint src --disable=missing-docstring && pylint test --disable=missing-docstring

Create or Update dependencies

pip freeze > requirements.txt

Resources

About

Data Structures, algorithms and design patterns in Python with tests and documentation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages