Skip to content

Commit

Permalink
Add newer Python versions and test them
Browse files Browse the repository at this point in the history
  • Loading branch information
LourensVeen committed Mar 31, 2024
1 parent 4db6ce2 commit 834f2a1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ classifiers = [
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]

version = "0.3.8.dev"
Expand All @@ -32,7 +35,7 @@ build-backend = "setuptools.build_meta"
legacy_tox_ini = """
[tox]
envlist = py37, py38, py39, py310
envlist = py37, py38, py39, py310, py311, py312
skip_missing_interpreters = true
[testenv]
Expand Down
9 changes: 7 additions & 2 deletions tests/container-test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends python3 \
python3-pip openssl python3-openssl libffi-dev libssl-dev openssh-client && \
pip3 install --upgrade pip

COPY tests/test_requirements.txt /home/cerulean/test_requirements.txt
RUN add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y --no-install-recommends python3.7 python3.7-dev python3.7-venv \
python3.8 python3.8-dev python3.8-venv python3.9 python3.9-dev python3.9-venv \
python3-venv python3.11 python3.11-dev python3.11-venv python3.12 python3.12-dev \
python3.12-venv

RUN pip3 install -r /home/cerulean/test_requirements.txt
COPY tests/test_requirements.txt /home/cerulean/test_requirements.txt

COPY . /home/cerulean/cerulean
RUN find /home/cerulean -path '*__pycache__*' -delete && \
Expand Down
28 changes: 22 additions & 6 deletions tests/container-test/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
#!/bin/bash

# Note: mypy can take a long time to run, so don't set the timeout too tight
pytest --timeout=120 -k 'not test_scheduler' --mypy --cov=cerulean --cov-report term-missing
result="$?"
echo "$result" >/home/cerulean/pytest_exit_codes
if [ "$result" != "0" ] ; then
exit $result
fi

for VERSION in 3.7 3.8 3.9 3.10 3.11 3.12 ; do

rm -rf .venv
python${VERSION} -m venv .venv
. .venv/bin/activate && python -m pip install --upgrade pip wheel
. .venv/bin/activate && python -m pip install -r /home/cerulean/test_requirements.txt

. .venv/bin/activate && python -m pytest --timeout=120 -k 'not test_scheduler' --mypy --cov=cerulean --cov-report term-missing

result="$?"
echo "$result" >/home/cerulean/pytest_exit_codes
if [ "$result" != "0" ] ; then
exit $result
fi

# clean up test files for the subsequent tests
chmod 755 /home/cerulean/test_files/testdir/dir1
rm -rf /home/cerulean/test_files/testdir

done


if [ "$CI" == 'true' ] ; then
pytest --timeout=120 -k 'test_scheduler and not flaky' -v -n 4 --max-worker-restart=0 --cov=cerulean --cov-append --cov-report term-missing --cov-report xml
Expand Down
8 changes: 3 additions & 5 deletions tests/test_cerulean.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def test_cerulean(target_images):
# Clean up target containers
sh.docker_compose.down(_cwd=workdir, _out=sys.stdout)

exit_code_1 = lines[0].strip()
assert exit_code_1 == '0'

exit_code_2 = lines[1].strip()
assert exit_code_2 == '0'
for line in lines:
exit_code = line.strip()
assert exit_code == '0'

0 comments on commit 834f2a1

Please sign in to comment.