Skip to content

Commit d81d930

Browse files
improve-testing-package (#546)
Summary: - Integrate `poetry` into virtual environment, in testing package build workflow. - Default `cwd` for flask app aggregator better supports testing mobility.
1 parent 865fe1d commit d81d930

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

cicd/util/01-build-robot-lib.sh

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,40 @@
11
#! /usr/bin/env bash
22

3-
poetryExe="$(which poetry)"
4-
rv="$?"
5-
if [ $rv -ne 0 ]; then
6-
>&2 echo "Poetry is not installed. Please install it first."
7-
exit 1
8-
fi
9-
if [ "$poetryExe" = "" ]; then
10-
>&2 echo "No poetry executable found in PATH. Please install it first."
11-
exit 1
12-
fi
3+
checkPoetry () {
4+
if ! command -v poetry &> /dev/null
5+
then
6+
>&2 echo "Poetry is not installed. Please install it first."
7+
exit 1
8+
fi
9+
}
1310

1411
CURDIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
1512

1613
REPOSITORY_ROOT="$(realpath ${CURDIR}/../..)"
1714

1815
PACKAGE_ROOT="${REPOSITORY_ROOT}/test"
1916

20-
venv_path="${REPOSITORY_ROOT}/.venv"
21-
22-
2317
rm -f ${PACKAGE_ROOT}/dist/*.whl || true
2418

19+
if [ ! -d "${PACKAGE_ROOT}/.venv" ]; then
20+
>&2 echo "No existing virtual environment, creating one..."
21+
>&2 echo "Creating virtual environment in ${PACKAGE_ROOT}/.venv"
22+
python -m venv "${PACKAGE_ROOT}/.venv"
23+
>&2 echo "Virtual environment created."
24+
>&2 echo "Installing poetry into virtual environment."
25+
${PACKAGE_ROOT}/.venv/bin/pip install -U pip setuptools
26+
${PACKAGE_ROOT}/.venv/bin/pip install poetry
27+
>&2 echo "Poetry installed into virtual environment."
28+
else
29+
>&2 echo "Using existing virtual environment in ${PACKAGE_ROOT}/.venv"
30+
fi
31+
2532
cd "${PACKAGE_ROOT}"
2633

34+
source ${PACKAGE_ROOT}/.venv/bin/activate
35+
36+
checkPoetry
37+
2738
poetry install
2839

2940
poetry build
@@ -38,7 +49,6 @@ else
3849
fi
3950

4051

41-
# >&2 echo "Artifact built successfully: ${expectedRobotLibArtifact}"
4252

4353

4454

test/python/stackql_test_tooling/web_service_keywords.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66

77
import os
88

9+
from pathlib import Path, PurePosixPath
10+
911
from typing import Optional
1012

1113
@library
1214
class web_service_keywords(Process):
1315

16+
_THIS_DIR: str = PurePosixPath(Path(os.path.dirname(os.path.abspath(__file__)))).as_posix()
1417

15-
16-
_DEFAULT_APP_ROOT: str = 'test/python/stackql_test_tooling/flask'
18+
_DEFAULT_APP_ROOT: str = os.path.join(_THIS_DIR, 'flask')
1719

1820
_DEFAULT_TLS_KEY_PATH: str = 'test/server/mtls/credentials/pg_server_key.pem'
1921

0 commit comments

Comments
 (0)