Tests Demo: Package that demonstrates how to add tests using unittest and coverage, and how to separate core tests from tests of test utilities and infra.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Charles Reid f868298e54
make it domain-specific
2 years ago
docs/img add docs 2 years ago
src make it domain-specific 2 years ago
tests make it domain-specific 2 years ago
.bumpversion.cfg add bump2version files 2 years ago
.flake8 add flake8 config file to make lint check easier 2 years ago
.gitignore add python gitignore 2 years ago
LICENSE add license and readme 2 years ago
Makefile final touches 2 years ago
Readme.md update readme 2 years ago
VERSION add bump2version files 2 years ago
common.mk add makefiles 2 years ago
environment.example remove unused env var 2 years ago
requirements-test.txt update requirements-test.txt name 2 years ago
requirements.txt add requirements files 2 years ago
setup.py update requirements-test.txt name 2 years ago

Readme.md

al-pacino

version-0.1.0

tests-unittesttests-coverage

codestyle-blackcodestyle-flake8

python-3.7-3.8-3.9-3.10

Al Pacino

A package that demonstrates how to add tests using unittest and coverage, and how to separately run core tests (tests of the core library functionality) and utility tests (tests of the supporting test utility functions and test infrastructure that do not use the core library itself.)

Quick Start

Start by cloning the repo:

git clone git@github.com:charlesreid1-toy-factory/al-pacino.git
cd al-pacino

Before you begin, create an environment file so you can use the Makefile:

cp environment.example environment

Update the environment file to point to the repository location on disk.

Now you can set up a virtual environment, and install the required packages and then the al_pacino library into it:

python3 -m virtualenv vp && source vp/bin/activate
python3 -m pip install -r requirements.txt
make clean
make build

Now you can use the library like so:

$ python3

>>> from al_pacino.animals import Cow
>>> print(Cow().speak())
moo

Now you're off and running.

Running Tests

To run tests, start by installing the test dependencies:

python3 -m pip install -r requirements-test.txt
python3 setup.py build install

Now run tests:

# Only run tests of test utilities and test support infrastructure
make utility_test

# Only run tests of the core Al Pacino library
make pacino_test

# Run all tests
make test

The utility test suite will not report any coverage, but the pacino test suite will:

$ make pacino_test
/Library/Developer/CommandLineTools/usr/bin/make -j1 tests/test_animals.py
flake8 src tests
coverage run -p --source=al_pacino tests/test_animals.py
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
/Library/Developer/CommandLineTools/usr/bin/make coverage
coverage combine
Combined data file .coverage.aptos.32308.349086
coverage report
Name                                                                             Stmts   Miss  Cover
----------------------------------------------------------------------------------------------------
vp/lib/python3.9/site-packages/al_pacino-0.1.0-py3.9.egg/al_pacino/__init__.py       1      0   100%
vp/lib/python3.9/site-packages/al_pacino-0.1.0-py3.9.egg/al_pacino/animals.py       18      0   100%
----------------------------------------------------------------------------------------------------
TOTAL                                                                               19      0   100%