From 6dde7ad252015dd491bce38d4b1eaf184f0f4347 Mon Sep 17 00:00:00 2001 From: Kevin Sheppard Date: Fri, 5 Jan 2024 12:48:24 +0000 Subject: [PATCH] CI: Add prerelease testing --- ci/azure/azure_template_posix.yml | 18 ++++++++++++++++-- ci/azure/install-posix.sh | 8 +++++++- randomgen/tests/test_extended_generator.py | 3 +-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ci/azure/azure_template_posix.yml b/ci/azure/azure_template_posix.yml index 45f4bbca5..e41d8b6b3 100644 --- a/ci/azure/azure_template_posix.yml +++ b/ci/azure/azure_template_posix.yml @@ -34,6 +34,9 @@ jobs: NUMPY: 1.23.0 python312_latest: python.version: '3.12' + python312_prerelease: + python.version: '3.12' + pip.pre: true python38_mid_conda: python.version: '3.8' use.conda: true @@ -119,7 +122,7 @@ jobs: python -c "import randomgen; randomgen.test(['-n', 'auto', '--junitxml=../junit/test-results.xml'])" popd displayName: 'Run tests (site-packages)' - condition: eq(variables['test.install'], 'true') + condition: and(ne(variables['pip.pre'], 'true'), eq(variables['test.install'], 'true')) - script: | echo "Testing editable install" @@ -129,7 +132,18 @@ jobs: echo pytest -m "${PYTEST_PATTERN}" --junitxml=junit/test-results.xml -n auto --durations=25 ${COVERAGE_OPTS} randomgen/tests pytest -m "${PYTEST_PATTERN}" --junitxml=junit/test-results.xml -n auto --durations=25 ${COVERAGE_OPTS} randomgen/tests displayName: 'Run tests (editable)' - condition: ne(variables['test.install'], 'true') + condition: and(ne(variables['pip.pre'], 'true'), ne(variables['test.install'], 'true')) + + - script: | + echo "Testing prerelease" + if [[ ${COVERAGE} == "true" ]]; then + export COVERAGE_OPTS="--cov-config .coveragerc --cov=randomgen --cov-report xml:coverage.xml --cov-report term" + fi + echo pytest -m "${PYTEST_PATTERN}" --junitxml=junit/test-results.xml -n auto --durations=25 ${COVERAGE_OPTS} randomgen/tests + pytest -m "${PYTEST_PATTERN}" --junitxml=junit/test-results.xml -n auto --durations=25 ${COVERAGE_OPTS} randomgen/tests + displayName: 'Run tests (pip pre)' + condition: eq(variables['pip.pre'], 'true') + continueOnError: true - task: PublishTestResults@2 inputs: diff --git a/ci/azure/install-posix.sh b/ci/azure/install-posix.sh index 8fd9a60d6..d7b52bbb3 100644 --- a/ci/azure/install-posix.sh +++ b/ci/azure/install-posix.sh @@ -15,7 +15,7 @@ fi # Not all available in conda python -m pip install setuptools "setuptools_scm[toml]<7" "oldest-supported-numpy" wheel pip black==22.6.0 isort flake8 --upgrade -EXTRA="pytest pytest-xdist coverage pytest-cov" +EXTRA="pytest pytest-xdist coverage pytest-cov colorama" if [[ -n ${NUMPY} ]]; then CMD="$CMD~=${NUMPY}"; fi; CMD="$CMD cython" @@ -26,3 +26,9 @@ if [[ ${USE_CONDA} == "true" ]]; then CMD="$CMD numba"; fi; if [[ ${USE_SCIPY} == "true" ]]; then CMD="$CMD scipy"; fi; echo $CMD eval $CMD + + +if [ "${PIP_PRE}" = true ]; then + python -m pip uninstall -y numpy pandas scipy + python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy pandas scipy --upgrade --use-deprecated=legacy-resolver +fi diff --git a/randomgen/tests/test_extended_generator.py b/randomgen/tests/test_extended_generator.py index 0b52f8fce..1884d7cf9 100644 --- a/randomgen/tests/test_extended_generator.py +++ b/randomgen/tests/test_extended_generator.py @@ -291,8 +291,7 @@ def test_random_uintegers(): assert isinstance(random.uintegers(), int) assert isinstance(random.uintegers(bits=32), int) with pytest.raises(ValueError): - with pytest.deprecated_call(): - random.uintegers(bits=128) + random.uintegers(bits=128) def test_str_repr():