Skip to content

Commit

Permalink
Fix CLI Smoke Tests / Make Python 3.13 Default
Browse files Browse the repository at this point in the history
  • Loading branch information
derks committed Nov 10, 2024
1 parent 2e30550 commit 82848ee
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 33 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
.PHONY: dev test test-core comply-fix docs clean dist dist-upload docker docker-push

dev:
docker-compose up -d
docker-compose exec cement pdm install
docker-compose exec cement-py38 pdm install
docker-compose exec cement-py39 pdm install
docker-compose exec cement-py310 pdm install
docker-compose exec cement-py311 pdm install
docker-compose exec cement-py313 pdm install
docker-compose exec cement /bin/bash
docker compose up -d
docker compose exec cement pdm install
docker compose exec cement-py38 pdm install
docker compose exec cement-py39 pdm install
docker compose exec cement-py310 pdm install
docker compose exec cement-py311 pdm install
docker compose exec cement-py312 pdm install
docker compose exec cement /bin/bash

test: comply
pdm run pytest --cov=cement tests
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ The latest stable version of Python 3 is the default, and target version accessi
$ docker-compose ps
Name Command State Ports
-------------------------------------------------------------------------
cement_cement-py38_1 /bin/bash Up
cement_cement-py39_1 /bin/bash Up
cement_cement-py38_1 /bin/bash Up
cement_cement-py39_1 /bin/bash Up
cement_cement-py310_1 /bin/bash Up
cement_cement-py311_1 /bin/bash Up
cement_cement_1 /bin/bash Up
cement_memcached_1 docker-entrypoint.sh memcached Up 11211/tcp
cement_redis_1 docker-entrypoint.sh redis ... Up 6379/tcp
cement_cement-py312_1 /bin/bash Up
cement_cement_1 /bin/bash Up
cement_memcached_1 docker-entrypoint.sh memcached Up 11211/tcp
cement_redis_1 docker-entrypoint.sh redis ... Up 6379/tcp
$ docker-compose exec cement-py39 /bin/bash
Expand Down
4 changes: 2 additions & 2 deletions cement/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def main(argv: Optional[List[str]] = None) -> None:
# Issue #679: https://github.com/datafolklabs/cement/issues/679
try:
import yaml, jinja2 # type: ignore # noqa: F401 E401
except ModuleNotFoundError:
raise FrameworkError('Cement CLI Dependencies are missing! Install cement[cli] extras ' +
except ModuleNotFoundError: # pragma: nocover
raise FrameworkError('Cement CLI Dependencies are missing! Install cement[cli] extras ' +
'package to resolve -> pip install cement[cli]')

with CementApp() as app:
Expand Down
15 changes: 3 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,9 @@ services:
context: .
dockerfile: docker/Dockerfile.dev-py311

# derks@2024-06-22: not necessary atm as default cement container is 3.12
# cement-py312:
# <<: *DEFAULTS
# image: "cement:dev-py312"
# build:
# context: .
# dockerfile: docker/Dockerfile.dev-py312

# derks@2024-06-22: future dev target
cement-py313:
cement-py312:
<<: *DEFAULTS
image: "cement:dev-py313"
image: "cement:dev-py312"
build:
context: .
dockerfile: docker/Dockerfile.dev-py313
dockerfile: docker/Dockerfile.dev-py312
4 changes: 2 additions & 2 deletions docker/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.12.3-alpine
FROM python:3.13-alpine
LABEL MAINTAINER="BJ Dierkes <derks@datafolklabs.com>"
ENV PS1="\[\e[0;33m\]|> cement-py312 <| \[\e[1;35m\]\W\[\e[0m\] \[\e[0m\]# "
ENV PS1="\[\e[0;33m\]|> cement-py313 <| \[\e[1;35m\]\W\[\e[0m\] \[\e[0m\]# "
ENV PATH="${PATH}:/root/.local/bin"

WORKDIR /src
Expand Down
2 changes: 1 addition & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions scripts/cli-smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

[ -z "$CEMENT_VERSION" ] && CEMENT_VERSION="3.0"
[ -z "$PYTHON_VERSIONS" ] && PYTHON_VERSIONS="3.8 3.9 3.10 3.11 3.12"
[ -z "$PYTHON_VERSIONS" ] && PYTHON_VERSIONS="3.8 3.9 3.10 3.11 3.12 3.13"

function smoke-test {
pyver=$1
Expand All @@ -18,7 +18,8 @@ function smoke-test {
-v `pwd`:/src \
python:$pyver \
/bin/bash
docker exec -it cement-cli-smoke-test /bin/bash -c "cd /src ; pip install dist/cement-*.whl"

docker exec -it cement-cli-smoke-test /bin/bash -c "cd /src ; pip install `ls dist/cement-*.tar.gz`[cli]"
tmp=$(docker exec cement-cli-smoke-test /bin/bash -c "mktemp -d")


Expand Down Expand Up @@ -49,6 +50,7 @@ function smoke-test {

docker exec cement-cli-smoke-test /bin/bash -c "cement generate project -D $tmp/myapp"
docker exec cement-cli-smoke-test /bin/bash -c "cd $tmp/myapp ; pip install -r requirements.txt"
docker exec cement-cli-smoke-test /bin/bash -c "cd $tmp/myapp ; pip install setuptools"
docker exec cement-cli-smoke-test /bin/bash -c "cd $tmp/myapp ; python setup.py install"
res=$(docker exec cement-cli-smoke-test /bin/bash -c "myapp --version")
echo "$res" | grep "Cement Framework $CEMENT_VERSION\.\d"
Expand Down Expand Up @@ -85,7 +87,7 @@ function smoke-test {

rm -rf tmp/cli-smoke-test.out
echo "output in tmp/cli-smoke-test.out"
docker-compose exec cement pdm build
docker compose exec cement pdm build

for pyver in $PYTHON_VERSIONS; do
echo -n "python $pyver . . . "
Expand Down

0 comments on commit 82848ee

Please sign in to comment.