# HG changeset patch # User drewp@bigasterisk.com # Date 1710615760 25200 # Node ID ddf021c870836ff842661ea935db744119730ba4 # Parent b5afa9363c3b8a525c649b85adc72b2f7147df53 pretxncommit diff -r b5afa9363c3b -r ddf021c87083 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sat Mar 16 12:02:40 2024 -0700 @@ -0,0 +1,7 @@ +__pycache__/ + +.pdm.toml +.pdm-python +.pdm-build/ +.vscode/settings.json +.pytest_cache/ \ No newline at end of file diff -r b5afa9363c3b -r ddf021c87083 precommit.sh --- a/precommit.sh Sat Mar 16 11:40:08 2024 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -#!/bin/bash -exit 0 - -# Define your project's root directory -PROJECT_ROOT="/path/to/your/project" - -# Change directory to the project root -cd "$PROJECT_ROOT" || exit - -# Install dependencies using pdm -pdm install - -# Check if the installation was successful -if [ $? -ne 0 ]; then - echo "Error: Failed to install dependencies with pdm." - exit 1 -fi - -# Run your code -# Modify the command as per your project structure and requirements -python your_script.py - -# Check if the execution was successful -if [ $? -ne 0 ]; then - echo "Error: Failed to run your code." - exit 1 -fi - -# If everything is successful, exit with 0 status -exit 0 diff -r b5afa9363c3b -r ddf021c87083 pretxncommit.sh --- /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