Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ omit =
tests
__init__.py
scip.pyx
patch = subprocess
2 changes: 1 addition & 1 deletion .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: pypa/cibuildwheel@v2.21.1
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_GROUPS: test
CIBW_TEST_COMMAND: "pytest {project}/tests"
CIBW_MANYLINUX_*_IMAGE: manylinux_2_28

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Prepare python environment
run: |
python -m pip install --upgrade pip
python -m pip install networkx cython pytest-cov numpy
python -m pip install --group coverage

- name: Install PySCIPOpt
run: |
Expand All @@ -47,7 +47,8 @@ jobs:
- name: Run pyscipopt tests
run: |
sudo apt-get install tzdata locales -y && sudo locale-gen pt_PT && sudo update-locale # add pt_PT locale that is used in tests
coverage run -m pytest
coverage run -m pytest -nauto
coverage combine
coverage report -m
coverage xml

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:
- name: Prepare python environment
run: |
python -m pip install --upgrade pip
python -m pip install networkx pytest-cov numpy
python -m pip install --group test-full

- name: Install PySCIPOpt
run: python -m pip install .

- name: Run pyscipopt tests
run: |
py.test
py.test -nauto

Windows-test:
env:
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
shell: powershell
run: |
python -m pip install --upgrade pip
python -m pip install networkx pytest-cov numpy
python -m pip install --group test-full

- name: Install PySCIPOpt
shell: powershell
Expand All @@ -81,7 +81,7 @@ jobs:
- name: Run pyscipopt tests
shell: powershell
run: |
py.test
py.test -nauto

MacOS-test:
runs-on: macos-latest
Expand All @@ -107,7 +107,7 @@ jobs:
- name: Prepare python environment
run: |
python -m pip install --upgrade pip
python -m pip install networkx pytest-cov pytest numpy
python -m pip install --group test-full

- name: Install PySCIPOpt
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Prepare python environment
run: |
python -m pip install --upgrade pip
python -m pip install wheel cython networkx pytest-cov build
python -m pip install wheel cython build

- name: Build package
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/update-packages-and-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ jobs:
- name: Prepare python environment
run: |
python -m pip install --upgrade pip
python -m pip install wheel cython networkx pytest-cov
python -m pip install --group test-full

- name: Install PySCIPOpt
run: python -m pip install .

- name: Run pyscipopt tests
run: |
py.test
py.test -nauto

windows-test:
needs: release-integration-test
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
shell: powershell
run: |
python -m pip install --upgrade pip
python -m pip install wheel cython networkx pytest-cov
python -m pip install --group test-full
- name: Install PySCIPOpt
shell: powershell
run: |
Expand All @@ -95,7 +95,7 @@ jobs:
- name: Run pyscipopt tests
shell: powershell
run: |
py.test
py.test -nauto


deploy-packages-and-generate-documentation:
Expand All @@ -117,7 +117,7 @@ jobs:
- name: Prepare python environment
run: |
python -m pip install --upgrade pip
python -m pip install wheel cython networkx pytest-cov build
python -m pip install wheel cython build

- name: Build package
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Implemented all binary operations between MatrixExpr and GenExpr
- Fixed the type of @ matrix operation result from MatrixVariable to MatrixExpr.
### Changed
- Add a PEP 735 dependency group for test dependencies in `pyproject.toml`
- Speed up MatrixVariable.sum(axis=None) via quicksum
### Removed

Expand Down
9 changes: 4 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,16 @@ Testing new installation
========================

To test your brand-new installation of PySCIPOpt you need
[pytest](https://pytest.org/) on your system.
some dependencies which can be installed via pip. The testing
dependencies are in the `test` dependency group.

pip install pytest

Here is the complete [installation
procedure](https://docs.pytest.org/en/latest/getting-started.html).
pip install --group test

Tests can be run in the `PySCIPOpt` directory with: :

py.test # all the available tests
py.test tests/test_name.py # a specific tests/test_name.py (Unix)
py.test -nauto # run tests in parallel using all available cores

Ideally, the status of your tests must be passed or skipped. Running
tests with pytest creates the `__pycache__` directory in `tests` and,
Expand Down
8 changes: 5 additions & 3 deletions docs/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,21 @@ To use debug information in PySCIPOpt you need to build it with the following co
Testing the Installation
==========================

To test your brand-new installation of PySCIPOpt you need `pytest <https://docs.pytest.org/en/stable/>`_
on your system. To get pytest simply run the command:
To test your brand-new installation of PySCIPOpt you need to
install some dependencies via pip. The testing dependencies are in
the `test` dependency group.

.. code-block:: bash

pip install pytest
pip install --group test

Tests can be run in the PySCIPOpt directory with the commands:

.. code-block:: bash

pytest # Will run all the available tests
pytest tests/test_name.py # Will run a specific tests/test_name.py (Unix)
pytest -nauto # Will run tests in parallel using all available cores

Ideally, the status of your tests must be passed or skipped.
Running tests with pytest creates the __pycache__ directory in tests and, occasionally,
Expand Down
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ dynamic = ["version"]
[project.urls]
Homepage = "https://github.com/SCIP-Interfaces/PySCIPOpt"

[dependency-groups]
test = [
"pytest",
"pytest-xdist",
]
test-full = [
{"include-group" = "test" },
"networkx", # only needed for a few tests
]
coverage = [
{ "include-group" = "test-full" },
"coverage",
"cython",
]

[tool.pytest.ini_options]
norecursedirs = ["check"]
testpaths = ["tests"]
Expand Down
7 changes: 1 addition & 6 deletions tests/test_logical.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
from pyscipopt import Model
from pyscipopt import quicksum

try:
import pytest
itertools = pytest.importorskip("itertools")
except ImportError:
import itertools
product = itertools.product
import pytest


# Testing AND/OR/XOR constraints
Expand Down
3 changes: 1 addition & 2 deletions tests/test_tsp.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from pyscipopt import Model, Conshdlr, quicksum, SCIP_RESULT

import itertools
import pytest

itertools = pytest.importorskip("itertools")
networkx = pytest.importorskip("networkx")

EPS = 1.e-6
Expand Down
Loading