Skip to content

Commit

Permalink
Add tox
Browse files Browse the repository at this point in the history
  • Loading branch information
31z4 committed Mar 24, 2023
1 parent f569dd2 commit 2023590
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 0 deletions.
7 changes: 7 additions & 0 deletions library/tox
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Maintainers: Elisey Zanko <[email protected]> (@31z4)
GitRepo: https://github.com/31z4/tox-docker.git
GitFetch: refs/heads/main
Architectures: amd64, arm64v8, ppc64le, s390x

Tags: 4-3, 4-3.0, 4-3.0.1, 4, 4.4-3, 4.4-3.0, 4.4-3.0.1, 4.4, 4.4.7-3, 4.4.7-3.0, 4.4.7-3.0.1, 4.4.7, latest
GitCommit: 881e2f195d431ca14d1da7e2e5044c3e0ff932b7
3 changes: 3 additions & 0 deletions test/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ imageTests+=(
[tomcat]='
tomcat-hello-world
'
[tox]='
tox-basics
'
[varnish]='
varnish
'
Expand Down
15 changes: 15 additions & 0 deletions test/tests/tox-basics/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -eo pipefail

dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"

image="$1"

newImage="$("$dir/../image-name.sh" librarytest/tox-basics "$image")"
"$dir/../docker-build.sh" "$dir" "$newImage" <<EOD
FROM $image
COPY dir/test.py dir/tox.ini ./
EOD

docker run --rm "$newImage"
6 changes: 6 additions & 0 deletions test/tests/tox-basics/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import unittest


class Test(unittest.TestCase):
def test(self):
self.assertTrue(True)
11 changes: 11 additions & 0 deletions test/tests/tox-basics/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[tox]
envlist = py{311,310,39,38,37},black
skipsdist = true
skip_missing_interpreters = false

[testenv]
commands = python -m unittest test.py

[testenv:black]
deps = black
commands = black --check test.py
23 changes: 23 additions & 0 deletions test/tests/tox-derivative/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -eo pipefail

dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"

image="$1"

newImage="$("$dir/../image-name.sh" librarytest/tox-derivative "$image")"
"$dir/../docker-build.sh" "$dir" "$newImage" <<EOD
FROM $image
USER root
RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
python3.12; \
rm -rf /var/lib/apt/lists/*
USER tox
COPY dir/test.py dir/tox.ini ./
EOD

docker run --rm "$newImage"
6 changes: 6 additions & 0 deletions test/tests/tox-derivative/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import unittest


class Test(unittest.TestCase):
def test(self):
self.assertTrue(True)
11 changes: 11 additions & 0 deletions test/tests/tox-derivative/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[tox]
envlist = py{312,311,310,39,38,37},black
skipsdist = true
skip_missing_interpreters = false

[testenv]
commands = python -m unittest test.py

[testenv:black]
deps = black
commands = black --check test.py

0 comments on commit 2023590

Please sign in to comment.