Skip to content

Commit

Permalink
Include package unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vyahello committed Oct 3, 2020
1 parent a36c80e commit 4d10e87
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@ python:
- "3.6"
- "3.7"
- "3.8"
addons:
apt:
update: true
env:
- PACKAGE_NAME=aiorequest PACKAGE_VERSION=0.1.6
before_install:
- sudo add-apt-repository -y ppa:duggan/bats
- sudo apt-get -y install bats
install:
- pip install pip -U
- pip install -r requirements-dev.txt -U
script:
- ./analyse-code.sh
- bats --pretty test-package.bats
after_success:
- coveralls
notifications:
Expand Down
63 changes: 63 additions & 0 deletions test-package.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bats


setup() {
:<<DOC
Installs emoji package
DOC
python setup.py install
}


teardown() {
:<<DOC
Removes emoji package
DOC
rm -rf ${PACKAGE_NAME}.egg-info dist build
pip uninstall -y ${PACKAGE_NAME}
}


@test "package name" {
:<<DOC
Test package name
DOC
pip list | grep ${PACKAGE_NAME}
[ "$?" -eq 0 ]
}


@test "package version" {
:<<DOC
Test package version
DOC
pip list | grep ${PACKAGE_VERSION}
[ "$?" -eq 0 ]
}


@test "pytest help message" {
:<<DOC
Test pytest help message
DOC
pytest --help | grep "Adds emoji to pytest results"
[ "$?" -eq 0 ]
}


@test "pytest long flag" {
:<<DOC
Test pytest long flag
DOC
pytest --help | grep "emoji-out"
[ "$?" -eq 0 ]
}


@test "pytest short flag" {
:<<DOC
Test pytest short flag
DOC
pytest --help | grep "eo"
[ "$?" -eq 0 ]
}

0 comments on commit 4d10e87

Please sign in to comment.