comparison pretxncommit.sh @ 6:d885fce5e4e7

try to reduce warnings about leaked sessions
author drewp@bigasterisk.com
date Sat, 16 Mar 2024 12:25:20 -0700
parents ddf021c87083
children d98cb018fad7
comparison
equal deleted inserted replaced
5:b34cd6619316 6:d885fce5e4e7
1 #!/bin/zsh -e 1 #!/bin/zsh -e
2 2
3 # e2e test including lib installs and test suite 3 # e2e test including lib installs and test suite
4 4
5 HG_NODE=${HG_NODE:-tip}
6 5
7 echo node = $HG_NODE 6 echo node = $HG_NODE
8 SRC_DIR=`pwd` 7 SRC_DIR=`pwd`
9 8
10 WORK_DIR=/tmp/rdferry_pretxncommit_$$ 9 WORK_DIR=/tmp/rdferry_pretxncommit_$$
13 TRAPZERR() { 12 TRAPZERR() {
14 rm -r $WORK_DIR 13 rm -r $WORK_DIR
15 } 14 }
16 15
17 16
18 # $STAGE_DIR shall have the exact state to be committed. 17 # If you're running pretxnsubmit.sh outside of a commit...
18 if [[ -z $HG_NODE ]]; then
19 echo "using src and test code from $SRC_DIR"
20 STAGE_DIR=$SRC_DIR
21 else
22 echo "using pre-commit code from -r $HG_NODE"
23 STAGE_DIR=$WORK_DIR/stage
24 hg clone -r $HG_NODE $SRC_DIR $STAGE_DIR
25 fi
19 26
20 STAGE_DIR=$WORK_DIR/stage 27 # TEST_PROJECT depends on rdferry being installed
21 hg clone -r $HG_NODE $SRC_DIR $STAGE_DIR 28 # from STAGE_DIR.
22
23
24 # TEST_PROJECT depends on rdferry from STAGE_DIR
25
26 TEST_PROJECT_DIR=$WORK_DIR/test_project 29 TEST_PROJECT_DIR=$WORK_DIR/test_project
27 mkdir $TEST_PROJECT_DIR 30 mkdir $TEST_PROJECT_DIR
28 cd $TEST_PROJECT_DIR 31 cd $TEST_PROJECT_DIR
29 pdm config --local venv.in_project True 32 pdm config --local venv.in_project True
30 pdm init --non-interactive 33 pdm init --non-interactive
31 pdm add $STAGE_DIR pytest pytest-asyncio aiohttp 34 pdm add $STAGE_DIR pytest pytest-asyncio aiohttp
32 pdm run python -c 'import rdferry; print(f"using {rdferry}")' 35 pdm run python -c 'import rdferry; print(f"using {rdferry}")'
33 36
34 # pretend the example code is test project's code 37 # Pretend the example code is test project's code.
35 cp -a ../stage/examples . 38 cp -a $STAGE_DIR/examples .
36 pdm run pytest examples 39 pdm run pytest examples
37 40
38 rm -r $WORK_DIR 41 rm -r $WORK_DIR
39 exit 0 42 exit 0