Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
Add some basic testing environment info.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed May 4, 2024
1 parent 5289fd7 commit b2c7047
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 1 deletion.
35 changes: 34 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ If you notice any differences, please report them.
Requirements
------------

- python 3.7+
- python 3.8+
- pygobject
- glib
- gtk+3 (optional)
Expand Down Expand Up @@ -129,6 +129,39 @@ actually prevent you from doing that (in accordance with PEP 3156), however
in mind that enclosed loops may be started at any time by third-party code
calling GLib's primitives.

Testing
-------

Testing GBulb requires a Linux environment that has GLib and GTK development
libraries available.

The tests folder contains a Dockerfile that defines a complete testing
environment. To use the Docker environment, run the following from the root of
the git checkout:

$ docker buildx build --tag beeware/gbulb:latest --file ./tests/Dockerfile .
$ docker run --rm --volume $(PWD):/home/brutus/gbulb:z -it beeware/gbulb:latest

This will drop you into an Ubuntu 24.04 shell that has Python 3.8-3.13
installed, mounting the current working directory as `/home/brutus/gbulb`. You
can use this to create virtual environments for each Python version.

Once you have an active virtual environment, run:

(venv) $ pip install -e .[dev]
(venv) $ pytest

to run the test suite. Alternatively, you can install tox, and then run:

# To test a single Python version
(venv) $ tox -e py

# To test Python 3.10 specifically
(venv) $ tox -e py310

# To test all versions
(venv) $ tox

Community
---------

Expand Down
48 changes: 48 additions & 0 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM ubuntu:24.04

# Disable pip's warnings and SDL audio
ENV PIP_ROOT_USER_ACTION=ignore \
PIP_NO_WARN_SCRIPT_LOCATION=0 \
SDL_AUDIODRIVER=dummy

# Run apt non-interactively; use ARG so this only applies while building the image
ARG DEBIAN_FRONTEND="noninteractive"

# Add deadsnakes
RUN apt-get update -y && \
apt-get install --no-install-recommends -y software-properties-common && \
add-apt-repository ppa:deadsnakes/ppa

# Install System python
RUN apt-get update -y && \
apt-get install --no-install-recommends -y \
libgirepository1.0-dev \
gir1.2-gtk-3.0 \
libcairo2-dev \
build-essential \
git \
python3.8-dev \
python3.8-venv \
python3.9-dev \
python3.9-venv \
python3.10-dev \
python3.10-venv \
python3.11-dev \
python3.11-venv \
python3-dev \
python3-venv \
python3.13-dev \
python3.13-venv \
python3-pip

RUN groupadd beeware && \
useradd brutus -g beeware --home /home/brutus && \
mkdir -p /home/brutus && chown brutus:beeware /home/brutus

# Use the brutus user for operations in the container
USER brutus

# Set the working directory
WORKDIR /home/brutus/gbulb

CMD /bin/bash

0 comments on commit b2c7047

Please sign in to comment.