Mercurial > code > home > repos > rdferry
changeset 6:d885fce5e4e7
try to reduce warnings about leaked sessions
author | drewp@bigasterisk.com |
---|---|
date | Sat, 16 Mar 2024 12:25:20 -0700 |
parents | b34cd6619316 |
children | d98cb018fad7 |
files | examples/run_server_make_request.py pretxncommit.sh |
diffstat | 2 files changed, 15 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/run_server_make_request.py Sat Mar 16 12:11:32 2024 -0700 +++ b/examples/run_server_make_request.py Sat Mar 16 12:25:20 2024 -0700 @@ -16,8 +16,10 @@ return self async def __aexit__(self, exc_type, exc, tb): + await self._session.close() self.subprocess.terminate() await self.subprocess.wait() + async def get(self, url: str) -> aiohttp.ClientResponse: while True: try:
--- a/pretxncommit.sh Sat Mar 16 12:11:32 2024 -0700 +++ b/pretxncommit.sh Sat Mar 16 12:25:20 2024 -0700 @@ -2,7 +2,6 @@ # e2e test including lib installs and test suite -HG_NODE=${HG_NODE:-tip} echo node = $HG_NODE SRC_DIR=`pwd` @@ -15,14 +14,18 @@ } -# $STAGE_DIR shall have the exact state to be committed. +# If you're running pretxnsubmit.sh outside of a commit... +if [[ -z $HG_NODE ]]; then + echo "using src and test code from $SRC_DIR" + STAGE_DIR=$SRC_DIR +else + echo "using pre-commit code from -r $HG_NODE" + STAGE_DIR=$WORK_DIR/stage + hg clone -r $HG_NODE $SRC_DIR $STAGE_DIR +fi -STAGE_DIR=$WORK_DIR/stage -hg clone -r $HG_NODE $SRC_DIR $STAGE_DIR - - -# TEST_PROJECT depends on rdferry from STAGE_DIR - +# TEST_PROJECT depends on rdferry being installed +# from STAGE_DIR. TEST_PROJECT_DIR=$WORK_DIR/test_project mkdir $TEST_PROJECT_DIR cd $TEST_PROJECT_DIR @@ -31,8 +34,8 @@ 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 . +# Pretend the example code is test project's code. +cp -a $STAGE_DIR/examples . pdm run pytest examples rm -r $WORK_DIR