Mercurial > code > home > repos > rdferry
diff pretxncommit.sh @ 4:ddf021c87083
pretxncommit
author | drewp@bigasterisk.com |
---|---|
date | Sat, 16 Mar 2024 12:02:40 -0700 |
parents | precommit.sh@fa108e01b284 |
children | d885fce5e4e7 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pretxncommit.sh Sat Mar 16 12:02:40 2024 -0700 @@ -0,0 +1,39 @@ +#!/bin/zsh -e + +# e2e test including lib installs and test suite + +HG_NODE=${HG_NODE:-tip} + +echo node = $HG_NODE +SRC_DIR=`pwd` + +WORK_DIR=/tmp/rdferry_pretxncommit_$$ +mkdir $WORK_DIR + +TRAPZERR() { + rm -r $WORK_DIR +} + + +# $STAGE_DIR shall have the exact state to be committed. + +STAGE_DIR=$WORK_DIR/stage +hg clone -r $HG_NODE $SRC_DIR $STAGE_DIR + + +# TEST_PROJECT depends on rdferry from STAGE_DIR + +TEST_PROJECT_DIR=$WORK_DIR/test_project +mkdir $TEST_PROJECT_DIR +cd $TEST_PROJECT_DIR +pdm config --local venv.in_project True +pdm init --non-interactive +pdm add $STAGE_DIR pytest pytest-asyncio aiohttp +pdm run python -c 'import rdferry; print(f"using {rdferry}")' + +# pretend the example code is test project's code +cp -a ../stage/examples . +pdm run pytest examples + +rm -r $WORK_DIR +exit 0