forked from octodns/octodns
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-module
executable file
·50 lines (46 loc) · 1.67 KB
/
test-module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
module="$1"
if [ -z "$module" ]; then
echo "Missing required parameter module, e.g. octodns/octodns-powerdns"
exit 1
fi
set -e
TMP_DIR=$(mktemp -d -t ci-XXXXXXXXXX)
echo "## venv ########################################################################"
VENV_PYTHON=$(command -v python3)
VENV_NAME="${TMP_DIR}/env"
"$VENV_PYTHON" -m venv "$VENV_NAME"
. "${VENV_NAME}/bin/activate"
echo "## environment & versions ######################################################"
python --version
pip --version
echo "## install octodns from pwd ####################################################"
python setup.py install
echo "## checkout provider module ####################################################"
cd $TMP_DIR
git clone "https://github.com/${module}.git"
cd $(basename $module)
echo "## install module dev requirements #############################################"
if [ -e setup.py ]; then
pip install -e .[dev] pytest-network
elif [ -f pyproject.toml ]; then
# install poetry
pip install poetry
# make sure that poetry doesn't blow away our locally installed octodns
sed -i'.bak' '/^octodns =/d' pyproject.toml
# now install all the deps
poetry install --no-root -v
else
echo "Unrecognized module management. Supports setup.py and poetry"
exit 1
fi
echo "## installed modules ###########################################################"
pip freeze
echo "## run module tests ############################################################"
export PYTHONPATH=.:$PYTHONPATH
if [ -e setup.py ]; then
pytest --disable-network
elif [ -f poetry.toml ]; then
poetry run pytest []
fi
echo "## complete ####################################################################"