Skip to content

Commit 35659a7

Browse files
committed
Add tests
1 parent ce00d01 commit 35659a7

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

.github/workflows/test_pyprima.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Test PyPRIMA
2+
3+
on:
4+
# Trigger the workflow on push or pull request
5+
#push:
6+
pull_request: # DANGEROUS! MUST be disabled for self-hosted runners!
7+
# Trigger the workflow by cron. The default time zone of GitHub Actions is UTC.
8+
schedule:
9+
- cron: '0 16 4-31/4 * *'
10+
# Trigger the workflow manually
11+
workflow_dispatch:
12+
13+
14+
jobs:
15+
16+
test:
17+
name: Run PyPRIMA tests
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest, windows-latest, macos-latest]
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v3.5.3
27+
28+
- name: Setup Python
29+
uses: actions/setup-python@v3
30+
with:
31+
python-version: "3.12"
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install numpy pytest scipy pytest-cov
37+
38+
- name: Conduct the test
39+
shell: bash
40+
run: |
41+
cd pyprima
42+
python -m pip install .
43+
pytest --cov=src --cov-report=html tests/
44+
PRIMA_DEBUGGING=1 pytest --cov=src --cov-append tests/test_end_to_end.py
45+
46+
47+
- name: Store artifacts
48+
uses: actions/upload-artifact@v3.1.2
49+
with:
50+
path: pyprima/htmlcov/*

pyprima/tests/test_pycutest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import pytest
2+
pytest.importorskip("pycutest")
3+
14
from optiprofiler.problems import load_cutest_problem
25
from pyprima import minimize, Bounds, LinearConstraint, NonlinearConstraint
36
import numpy as np

0 commit comments

Comments
 (0)