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
11 changes: 6 additions & 5 deletions .github/actions/test-py/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,20 @@ runs:
shell: bash
run: |
export PYTHON_VERSION_NO_DOT=$(echo "${{ inputs.version }}" | sed 's/\.//g')
for pkg in `ls pycode/wheelhouse/*cp$PYTHON_VERSION_NO_DOT*.whl`; do python -m pip install $pkg; done # packages that contain native extensions are version specific
for pkg in `ls pycode/wheelhouse/*py3*.whl`; do python -m pip install $pkg; done # pure python packages are not version specific
pip install -r pycode/memilio-${{ inputs.package }}/requirements-dev.txt
shopt -s nullglob
for pkg in pycode/wheelhouse/*cp$PYTHON_VERSION_NO_DOT*.whl; do python -m pip install "$pkg"; done # packages that contain native extensions are version specific
for pkg in pycode/wheelhouse/*py3*.whl; do python -m pip install "$pkg"; done # pure python packages are not version specific
python -m pip install --upgrade-strategy only-if-needed --prefer-binary --find-links pycode/wheelhouse "memilio-${{ inputs.package }}[dev]"
- name: Run unit tests
shell: bash
run: |
cd pycode/memilio-${{inputs.package}}/memilio/${{inputs.package}}_test
cd pycode/memilio-${{inputs.package}}/tests
if [[ "${{ inputs.coverage }}" == "ON" ]]; then
python -W ignore::DeprecationWarning -m coverage run --include=**/site-packages/memilio/* -m unittest
python -m coverage report
python -m coverage xml -o coverage_python.xml
python -m coverage html -d coverage_python
cp -r coverage_python ../../../../
cp -r coverage_python ../../../
else
python -m unittest
fi
Expand Down
8 changes: 5 additions & 3 deletions .github/actions/test-pylint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ runs:
uses: actions/download-artifact@v4
with:
name: python-wheels-${{ inputs.package }}
path: pycode/wheelhouse
- name: Install Python Wheels
shell: bash
run: |
for pkg in `ls pycode/wheelhouse/*cp311*.whl`; do python -m pip install $pkg; done # packages that contain native extensions are version specific
for pkg in `ls pycode/wheelhouse/*py3*.whl`; do python -m pip install $pkg; done # pure python packages are not version specific
pip install -r pycode/memilio-${{ inputs.package }}/requirements-dev.txt
shopt -s nullglob
for pkg in pycode/wheelhouse/*cp311*.whl; do python -m pip install "$pkg"; done # packages that contain native extensions are version specific
for pkg in pycode/wheelhouse/*py3*.whl; do python -m pip install "$pkg"; done # pure python packages are not version specific
python -m pip install --upgrade-strategy only-if-needed --prefer-binary --find-links pycode/wheelhouse "memilio-${{ inputs.package }}[dev]"
- name: Run pylint
shell: bash
run: |
Expand Down
17 changes: 10 additions & 7 deletions pycode/memilio-epidata/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,21 @@ The following packages are used by the tests:

See Installation on how to install all these dependencies automatically.

To run the tests make sure the package is installed in editable mode (``pip install -e .``) and run

.. code:: sh
To run the tests, make sure the package is installed, and you are in the source directory, then run:

```bash
cd tests
python -m unittest
```

Alternatively, if the package is installed normally (``pip install .``), you have to run the tests from outside the source directory to avoid import errors:
This works with both normal (`pip install .`) and editable (`pip install -e .`) installations.

.. code:: sh
Alternatively, you can run the tests from outside the source directory:

cd /path/to/another/directory
python -m unittest discover -s /path/to/memilio/pycode/memilio-epidata/memilio/epidata_test
```bash
cd /path/to/another/directory
python -m unittest discover -s /path/to/memilio/pycode/memilio-epidata/tests
```

To get the coverage report do

Expand Down
23 changes: 0 additions & 23 deletions pycode/memilio-epidata/memilio/epidata_test/__init__.py

This file was deleted.

10 changes: 7 additions & 3 deletions pycode/memilio-epidata/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,20 @@ dependencies = [
"PyQt6",
"python-calamine",
"python-magic-bin; sys_platform == 'win32'",
"python-magic; sys_platform != 'win32'"
"python-magic; sys_platform != 'win32'",
# first support of python 3.11 is 4.6
# 5.3.4 has conflicts with openpyxl
# 5.3.3 broken
"pyfakefs>=4.6,<5.3.3"
]

[project.optional-dependencies]
dev = [
"pyfakefs>=4.6,<5.3.3",
"coverage>=7.0.1",
# pylint 2.16 creates problem with wrapt package version
"pylint>=2.13.0,<2.16",
"pylint_json2html==0.4.0"
]
]

[project.scripts]
getcasedata = "memilio.epidata.getCaseData:main"
Expand Down
9 changes: 0 additions & 9 deletions pycode/memilio-epidata/requirements-dev.txt

This file was deleted.

12 changes: 8 additions & 4 deletions pycode/memilio-generation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,21 @@ You can print the AST of your model into a file (Usefull for development/debuggi

## Testing

The package provides a test suite in `memilio/generation_test`. To run the tests make sure the package is installed in editable mode (`pip install -e .`) and run
The package provides a test suite in the `tests` directory.
To run the tests, make sure the package is installed, and you are in the source directory, then run:

```bash
cd tests
python -m unittest
```

Alternatively, if the package is installed normally (`pip install .`), you have to run the tests from outside the source directory to avoid import errors:
This works with both normal (`pip install .`) and editable (`pip install -e .`) installations.

Alternatively, you can run the tests from outside the source directory:

```bash
cd /path/to/another/directory
python -m unittest discover -s /path/to/memilio/pycode/memilio-generation/memilio/generation_test
python -m unittest discover -s /path/to/memilio/pycode/memilio-generation/tests
```

## Development
Expand All @@ -58,4 +62,4 @@ When implementing new model features you can follow these steps:
- Adjust the substitution dictionaries in the [Generator class](./memilio/generation/generator.py).
- Write new/Adjust script in the [tool folder](./memilio/tools/) for the model and try to run.
- Add new strings in the [Default dict](/pycode/memilio-generation/memilio/generation/default_generation_dict.py)
- Update [tests](./memilio/generation_test/).
- Update [tests](./tests/).
23 changes: 0 additions & 23 deletions pycode/memilio-generation/memilio/generation_test/__init__.py

This file was deleted.

2 changes: 0 additions & 2 deletions pycode/memilio-generation/requirements-dev.txt

This file was deleted.

17 changes: 14 additions & 3 deletions pycode/memilio-plot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,22 @@ The following packages are used by the tests:

See Installation on how to install all these dependencies automatically.

To run the tests make

.. code:: sh
To run the tests, make sure the package is installed, and you are in the source directory, then run:

```bash
cd tests
python -m unittest
```

This works with both normal (``pip install .``) and editable (``pip install -e .``) installations.

Alternatively, you can run the tests from outside the source directory:

```bash
cd /path/to/another/directory
python -m unittest discover -s /path/to/memilio/pycode/memilio-plot/tests
```


To get the coverage report do

Expand Down
23 changes: 0 additions & 23 deletions pycode/memilio-plot/memilio/plot_test/__init__.py

This file was deleted.

6 changes: 4 additions & 2 deletions pycode/memilio-plot/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ dependencies = [
"geopandas",
"h5py",
"imageio",
"datetime"
"datetime",
# first support of python 3.11
"pyfakefs>=4.6"
]

[project.optional-dependencies]
dev = [
"pyfakefs>=4.6",
"coverage>=7.0.1",
# pylint 2.16 creates problem with wrapt package version
"pylint>=2.13.0,<2.16",
"pylint_json2html==0.4.0"
]
Expand Down
7 changes: 0 additions & 7 deletions pycode/memilio-plot/requirements-dev.txt

This file was deleted.

11 changes: 6 additions & 5 deletions pycode/memilio-simulation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,18 @@ Detailed documentation under construction. See the scripts in the [examples](../

## Testing

The package provides a test suite in `memilio/simulation_test`. To run the tests make sure the package is installed in editable mode (`pip install -e .`) and run
The package provides a test suite in `tests/`. To run the tests, make sure the package is installed, and you are in the source directory, then run:

```bash
cd tests
python -m unittest
```

Alternatively, if the package is installed normally (`pip install .`), you have to run the tests from outside the source directory to avoid import errors:
This works with both normal (`pip install .`) and editable (`pip install -e .`) installations.

Alternatively, you can run the tests from outside the source directory:

```bash
cd /path/to/another/directory
python -m unittest discover -s /path/to/memilio/pycode/memilio-simulation/memilio/simulation_test
python -m unittest discover -s /path/to/memilio/pycode/memilio-simulation/tests
```

Note that these tests do not cover every case of the C++ library, they are only intended to test the binding code. To verify correctness of the C++ library itself, build and run the [C++ unit tests](../../cpp/README.md).
23 changes: 0 additions & 23 deletions pycode/memilio-simulation/memilio/simulation_test/__init__.py

This file was deleted.

10 changes: 6 additions & 4 deletions pycode/memilio-simulation/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ authors = [{ name = "MEmilio Team" }]
maintainers = [
{ email = "[email protected]" }
]
dependencies = []

[project.optional-dependencies]
dev = [
dependencies = [
# smaller numpy versions cause a security issue, 1.25 breaks testing with pyfakefs
"numpy>=1.22,<1.25",
# smaller pandas versions contain a bug that sometimes prevents reading
"pandas>=2.0.0"
]

[project.optional-dependencies]
dev = []

[project.urls]
Homepage = "https://github.com/SciCompMod/memilio"
Team = "https://memilio.readthedocs.io/en/latest/team.html"
Expand Down
2 changes: 0 additions & 2 deletions pycode/memilio-simulation/requirements-dev.txt

This file was deleted.

9 changes: 6 additions & 3 deletions pycode/memilio-surrogatemodel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@ The package currently provides the following modules:
- `tests`: this file contains all tests

## Testing
The package provides a test suite in `memilio/surrogatemodel_test`. To run the tests make sure the package is installed in editable mode (`pip install -e .`) and run
The package provides a test suite in `tests/`. To run the tests, make sure the package is installed, and you are in the source directory, then run:

```bash
cd tests
python -m unittest
```

Alternatively, if the package is installed normally (`pip install .`), you have to run the tests from outside the source directory to avoid import errors:
This works with both normal (`pip install .`) and editable (`pip install -e .`) installations.

Alternatively, you can run the tests from outside the source directory:

```bash
cd /path/to/another/directory
python -m unittest discover -s /path/to/memilio/pycode/memilio-surrogatemodel/memilio/surrogatemodel_test
python -m unittest discover -s /path/to/memilio/pycode/memilio-surrogatemodel/tests
```

This file was deleted.

5 changes: 3 additions & 2 deletions pycode/memilio-surrogatemodel/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ dependencies = [
"numpy>=1.22,<1.25",
"tensorflow",
"matplotlib",
"scikit-learn"
"scikit-learn",
# first support of python 3.11
"pyfakefs>=4.6"
]

[project.optional-dependencies]
dev = [
"pyfakefs>=4.6",
"coverage>=7.0.1"
]

Expand Down
Loading
Loading