Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nbelakovski committed Jan 7, 2025
1 parent ce00d01 commit cf3f0f7
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/test_pyprima.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test PyPRIMA

Check failure

Code scanning / check-spelling

Check File Path Error test

pyprima is not a recognized word. (check-file-path)

on:
# Trigger the workflow on push or pull request
#push:
pull_request: # DANGEROUS! MUST be disabled for self-hosted runners!
# Trigger the workflow by cron. The default time zone of GitHub Actions is UTC.
schedule:
- cron: '0 16 4-31/4 * *'
# Trigger the workflow manually
workflow_dispatch:


jobs:

test:
name: Run PyPRIMA tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout repository
uses: actions/[email protected]
with:
submodules: recursive
# ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS
# As of 230425, checkout with ssh fails frequently on Windows runners.

- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy pytest scipy pytest-cov

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error test

cov is not a recognized word. (unrecognized-spelling)
- name: Conduct the test
run: |
cd pyprima

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error test

pyprima is not a recognized word. (unrecognized-spelling)
python -m pip install .
pytest --cov=src --cov-report=html tests/
PRIMA_DEBUGGING=1 pytest --cov=src --cov-append tests/test_end_to_end.py

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error test

cov is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error test

cov is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error test

cov is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error test

cov is not a recognized word. (unrecognized-spelling)
- name: Store artifacts
uses: actions/[email protected]
if: always() # Always run even if the workflow is canceled manually or due to overtime.
# Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`.
# In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent.
with:
path: ${{ env.TEST_DIR }}/pyprima/htmlcov/*
3 changes: 3 additions & 0 deletions pyprima/tests/test_pycutest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import pytest
pytest.importorskip("pycutest")

from optiprofiler.problems import load_cutest_problem
from pyprima import minimize, Bounds, LinearConstraint, NonlinearConstraint
import numpy as np
Expand Down

0 comments on commit cf3f0f7

Please sign in to comment.