Skip to content
Snippets Groups Projects
Verified Commit b1290043 authored by Frank Sauerburger's avatar Frank Sauerburger
Browse files

Switch to pytest

parent 2e68faf7
No related branches found
No related tags found
1 merge request!29Resolve "Python version maintenance"
Pipeline #14582 waiting for manual action
......@@ -61,45 +61,49 @@ badges:
pythontest:all:
extends: .pythontest:base
parallel: 5 # number python versions
variables:
N_RANDOM_TESTS: 100
script:
- export PY_VERSION=$(echo "$PYTHON_VERSIONS" | cut -f "$CI_NODE_INDEX" -d " ")
- ci/pytest_wheel.sh
- /opt/python/$${PY_VERSION}/bin/pip install wheelhouse/sortednp-*-$${PY_VERSION}-*.whl
- /opt/python/$${PY_VERSION}/bin/pip install -r requirements-dev.txt
- /opt/python/$${PY_VERSION}/bin/pytest --pyargs sortednp.tests
rules:
- if: $CI_COMMIT_BRANCH == "master"
pythontest:single:
extends: .pythontest:base
variables:
PY_VERSION: cp312-cp312
script:
- ci/pytest_wheel.sh
- /opt/python/cp312-312/bin/pip install wheelhouse/sortednp-*-cp312-312-*.whl
- /opt/python/cp312-312/bin/pip install -r requirements-dev.txt
- /opt/python/cp312-312/bin/pytest --pyargs sortednp.tests
rules:
- if: $CI_COMMIT_BRANCH != "master"
- if: $CI_COMMIT_BRANCH != "master" && $CI_PIPELINE_SOURCE != "merge_request_event"
#### cxx test
.cxxtest:base: &cxxtest_template
stage: test
image: ${REGISTRY}/gtest_x86_64
dependencies:
- bdist
cxxtest:all:
extends: .cxxtest:base
parallel: 5 # number python versions
script:
- export PY_VERSION=$(echo "$PYTHON_VERSIONS" | cut -f "$CI_NODE_INDEX" -d " ")
- ci/cxxtest_wheel.sh
rules:
- if: $CI_COMMIT_BRANCH == "master"
cxxtest:single:
extends: .cxxtest:base
variables:
PY_VERSION: cp312-cp312
script:
- ci/cxxtest_wheel.sh
rules:
- if: $CI_COMMIT_BRANCH != "master"
# .cxxtest:base: &cxxtest_template
# stage: test
# image: ${REGISTRY}/gtest_x86_64
# dependencies:
# - bdist
#
# cxxtest:all:
# extends: .cxxtest:base
# parallel: 5 # number python versions
# script:
# - export PY_VERSION=$(echo "$PYTHON_VERSIONS" | cut -f "$CI_NODE_INDEX" -d " ")
# - ci/cxxtest_wheel.sh
# rules:
# - if: $CI_COMMIT_BRANCH == "master"
#
# cxxtest:single:
# extends: .cxxtest:base
# variables:
# PY_VERSION: cp312-cp312
# script:
# - ci/cxxtest_wheel.sh
# rules:
# - if: $CI_COMMIT_BRANCH != "master" && $CI_PIPELINE_SOURCE != "merge_request_event"
#### Doctest
readme_test:
......@@ -112,36 +116,38 @@ readme_test:
- doxec README.md
#### Source install
.source_install:base:
stage: test
image: python:3.12
before_script:
- pip3 install -r requirements.txt
- pip3 install parameterized
source:out_of_bounds:
extends: .source_install:base
stage: test
image: python:3.12
script:
- sed -i '1s/^/#define CHECK_ARRAY_BOUNDS/' src/sortednpmodule.cpp
- pip3 install .
- ci/pytest.sh
- pip install .
- pip install -r requirements-dev.txt
- pytest .
rules:
- if: $CI_COMMIT_BRANCH == "master"
source_install:pip:
extends: .source_install:base
stage: test
image: python:3.12
script:
- pip3 install .
- ci/pytest.sh
- pip install -r requirements-dev.txt
- pip install .
- pytest .
rules:
- if: $CI_COMMIT_BRANCH == "master"
source_install:tar:
extends: .source_install:base
stage: test
image: python:3.12
dependencies:
- sdist
script:
- pip3 install dist/sortednp-*.tar.gz
- ci/pytest.sh
- pip install -r requirements-dev.txt
- pip install dist/sortednp-*.tar.gz
- pytest --pyargs sortednp.tests
rules:
- if: $CI_COMMIT_BRANCH == "master"
......
#!/bin/bash
if [ "$CI_COMMIT_BRANCH" == "master" ]; then
echo "Setting N_RANDOM_TESTS=100"
export N_RANDOM_TESTS=100
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
python3 ${DIR}/../setup.py test -q
#!/bin/bash
if [ -z "${PY_VERSION}" ]; then
echo "Error: Set PY_VERSION before running this script!"
echo " e.g. export PY_VERSION='cp34-cp34m'"
exit 1
fi
if [ "$CI_COMMIT_BRANCH" == "master" ]; then
echo "Setting N_RANDOM_TESTS=100"
export N_RANDOM_TESTS=100
fi
/opt/python/${PY_VERSION}/bin/pip install wheel wheelhouse/sortednp-*-${PY_VERSION}-*.whl
/opt/python/${PY_VERSION}/bin/pip install nose parameterized
/opt/python/${PY_VERSION}/bin/nosetests -P sortednp.tests
-r requirements.xtt
pytest==7.2.0
parameterized==0.9.0
wheel==0.38.4
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment