Python 3.8 Development / Testing

- Targets Python 3.8 as default development version
- Resolves Issue #583
- Resolves Issue #582
- Resolves Issue #581
This commit is contained in:
BJ Dierkes 2020-09-02 12:10:39 -05:00
parent 559b316986
commit 4527ce7608
11 changed files with 51 additions and 14 deletions

View File

@ -11,6 +11,9 @@ matrix:
- python: 3.7
dist: xenial
sudo: true
- python: 3.8
dist: xenial
sudo: true
services:
- memcached
- redis-server

View File

@ -1,4 +1,4 @@
FROM python:3.6-alpine
FROM python:3.8-alpine
MAINTAINER BJ Dierkes <derks@datafolklabs.com>
ENV PS1="\[\e[0;33m\]|> cement <| \[\e[1;35m\]\W\[\e[0m\] \[\e[0m\]# "
WORKDIR /src

View File

@ -50,7 +50,7 @@ The Cement CLI Application Framework is Open Source and is distributed under the
### Docker
This project includes a `docker-compose` configuration that sets up all required services, and dependencies for development. This is the recommended path for local development, and is the only fully supported option.
This project includes a `docker-compose` configuration that sets up all required services, and dependencies for development and testing. This is the recommended path for local development, and is the only fully supported option.
The following creates all required docker containers, and launches an ASH shell within the `cement` dev container for development.
```
@ -64,9 +64,32 @@ The above is the equivalent of running:
```
$ docker-compose up -d
$ docker-compose exec cement /bin/ash
$ docker-compose exec cement /bin/bash
```
**Testing Alternative Versions of Python**
The latest stable version of Python 3 is the default, and target version accessible as the `cement` container within Docker Compose. For testing against alternative versions of python, additional containers are created (ex: `cement-py37`, `cement-py38`, etc). You can access these containers via:
```
$ docker-compose ps
Name Command State Ports
-------------------------------------------------------------------------
cement_cement-py35_1 /bin/bash Up
cement_cement-py36_1 /bin/bash Up
cement_cement-py37_1 /bin/bash Up
cement_cement-py38_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-py37 /bin/bash
|> cement-py37 <| src #
```
### VirtualENV
An traditional VirtualENV helper is available:
@ -146,4 +169,10 @@ Execute the following to run all compliance and unit tests:
$ make test
```
A coverage report is printed to console, as well as the HTML version created in `coverage-report`:
```
$ open coverage-report/index.html
```
See `Makefile` for all other common development actions.

View File

@ -209,7 +209,7 @@ def backup(path, suffix='.bak'):
shutil.copytree(path, new_path)
break
else:
break
break # pragma: nocover
return new_path

View File

@ -39,12 +39,12 @@ services:
dockerfile: docker/Dockerfile.dev-py37
<<: *DEFAULTS
# cement-py38:
# image: "cement:dev-py38"
# build:
# context: .
# dockerfile: docker/Dockerfile.dev-py38
# <<: *DEFAULTS
cement-py38:
image: "cement:dev-py38"
build:
context: .
dockerfile: docker/Dockerfile.dev-py38
<<: *DEFAULTS
redis:
redis:

View File

@ -1,4 +1,4 @@
FROM python:3.7-alpine
FROM python:3.8-alpine
MAINTAINER BJ Dierkes <derks@datafolklabs.com>
ENV PS1="\[\e[0;33m\]|> cement <| \[\e[1;35m\]\W\[\e[0m\] \[\e[0m\]# "
@ -16,6 +16,7 @@ RUN apk update \
git \
libffi \
libffi-dev \
openssl-dev \
&& ln -sf /usr/bin/vim /usr/bin/vi \
&& pip install --no-cache-dir -r requirements-dev.txt
COPY . /src

View File

@ -16,6 +16,7 @@ RUN apk update \
git \
libffi \
libffi-dev \
openssl-dev \
&& ln -sf /usr/bin/vim /usr/bin/vi \
&& pip install --no-cache-dir -r requirements-dev.txt
COPY . /src

View File

@ -16,6 +16,7 @@ RUN apk update \
git \
libffi \
libffi-dev \
openssl-dev \
&& ln -sf /usr/bin/vim /usr/bin/vi \
&& pip install --no-cache-dir -r requirements-dev.txt
COPY . /src

View File

@ -16,6 +16,7 @@ RUN apk update \
git \
libffi \
libffi-dev \
openssl-dev \
&& ln -sf /usr/bin/vim /usr/bin/vi \
&& pip install --no-cache-dir -r requirements-dev.txt
COPY . /src

View File

@ -16,6 +16,7 @@ RUN apk update \
git \
libffi \
libffi-dev \
openssl-dev \
&& ln -sf /usr/bin/vim /usr/bin/vi \
&& pip install --no-cache-dir -r requirements-dev.txt
COPY . /src

View File

@ -59,7 +59,7 @@ def test_prompt(tmp):
with GenerateApp(argv=argv) as app:
msg = "reading from stdin while output is captured"
with raises(OSError, message=msg):
with raises(OSError, match=msg):
app.run()
@ -80,8 +80,8 @@ def test_invalid_variable_value(tmp):
argv = ['generate', 'test2', tmp.dir, '--defaults']
with GenerateApp(argv=argv) as app:
msg = "Invalid Response (must match: '.*not-bar1.*')"
with raises(AssertionError, message=msg):
msg = "Invalid Response.*"
with raises(AssertionError, match=msg):
app.run()