Skip to content

Commit 031793f

Browse files
committed
add tox testenv that verifies that source builds contain everything necessary for tests
1 parent 0f41149 commit 031793f

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

test/source-build-check.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# Verify that tests can be successfully run from the source build.
3+
WORKINGDIR=$1
4+
DISTDIR=$2
5+
6+
echo "Locating the source build and copying it into the working directory."
7+
DISTFILE=`ls $DISTDIR/dynamodb-encryption-sdk-*.tar.gz | tail -1`
8+
cp $DISTFILE $WORKINGDIR
9+
DISTFILE=`ls $WORKINGDIR/dynamodb-encryption-sdk-*.tar.gz | tail -1`
10+
11+
echo "Extracting the source build."
12+
cd $WORKINGDIR
13+
tar xzvf $DISTFILE
14+
rm $DISTFILE
15+
EXTRACTEDDIR=`ls | tail -1`
16+
cd $EXTRACTEDDIR
17+
18+
echo "Installing requirements from extracted source build."
19+
pip install -r test/requirements.txt
20+
pip install -e .
21+
22+
echo "Running tests from extracted source build."
23+
pytest --cov dynamodb_encryption_sdk -m "local and not slow and not veryslow and not nope"

tox.ini

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py{27,34,35,36}-{local,integ,examples}-fast, nocmk,
3+
py{27,34,35,36}-{local,integ,examples}-fast, nocmk, sourcebuildcheck,
44
bandit, doc8, readme,
55
flake8, pylint,
66
flake8-tests, pylint-tests,
@@ -66,6 +66,17 @@ sitepackages = False
6666
deps = -rtest/requirements.txt
6767
commands = {[testenv:base-command]commands} -m "local and not slow and not veryslow and not nope"
6868

69+
# Verify that tests can be successfully run from the source build.
70+
[testenv:sourcebuildcheck]
71+
basepython = python3
72+
sitepackages = False
73+
recreate = True
74+
deps =
75+
{[testenv:build]deps}
76+
commands =
77+
{[testenv:build]commands}
78+
{toxinidir}/test/source-build-check.sh {envtmpdir} {toxinidir}/dist
79+
6980
# mypy
7081
[testenv:mypy-coverage]
7182
commands =

0 commit comments

Comments
 (0)