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
6 changes: 3 additions & 3 deletions .github/workflows/measure-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
- name: Install uxsim and dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[advanced]
pip install -e .[dev,advanced]
- name: Install pytest other dependencies
run: |
# Install testing dependencies with compatible versions for parallel execution
pip install "pytest>=8.4.0" "pytest-xdist>=3.8.0" "pytest-rerunfailures>=16.0" pytest-cov setuptools osmnx requests neatnet geopandas shapely
# Install optional packages required for these tests
pip install osmnx requests
- name: Run verifications with pytest
run: pytest -n auto tests/test_verification_straight_road.py tests/test_verification_route_choice.py tests/test_verification_node.py tests/test_verification_exceptional.py tests/test_verification_sioux_falls.py tests/test_verification_multilane.py tests/test_verification_taxi.py tests/test_verification_dta_solvers.py tests/test_other_functions.py tests/test_optional_functions_python313.py --durations=0 -v --cov=uxsim --cov-report=xml --cov-config=.github/.coveragerc
- name: Upload coverage reports to Codecov
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
- name: Install uxsim and dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install .[dev]
- name: Install pytest other dependencies
run: |
# Install testing dependencies with compatible versions for parallel execution
pip install "pytest>=8.4.0" "pytest-xdist>=3.8.0" "pytest-rerunfailures>=16.0" setuptools gymnasium torch osmnx deap streamlit
# Install optional packages required for these tests
pip install gymnasium torch osmnx deap streamlit
- name: Run examples with pytest
run: pytest -n auto tests/test_examples.py --durations=0 -v
4 changes: 2 additions & 2 deletions .github/workflows/run-notebook-demos-extra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest jupyter nbformat setuptools gymnasium torch osmnx deap
pip install .
pip install .[dev]
pip install gymnasium torch osmnx deap
- name: Run tests
run: pytest tests/test_notebook_demos_extra.py --durations=0 -s -v
3 changes: 1 addition & 2 deletions .github/workflows/run-notebook-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest jupyter nbformat
pip install .
pip install .[dev]
- name: Run tests
run: pytest tests/test_notebook_demos.py --durations=0 -s -v
6 changes: 3 additions & 3 deletions .github/workflows/test-functions-python313.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
- name: Install uxsim and dependencies
run: |
python -m pip install --upgrade pip
pip install .[advanced]
pip install .[dev,advanced]
- name: Install pytest other dependencies
run: |
# Install testing dependencies with compatible versions for parallel execution
pip install "pytest>=8.4.0" "pytest-xdist>=3.8.0" "pytest-rerunfailures>=16.0" setuptools requests
# Install optional packages required for these tests
pip install requests
- name: Run tests with pytest
run: pytest -n auto tests/test_optional_functions_python313.py --durations=0 -v

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
- name: Install uxsim and dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install .[dev]
- name: Install pytest other dependencies
run: |
# Install testing dependencies with compatible versions for parallel execution
pip install "pytest>=8.4.0" "pytest-xdist>=3.8.0" "pytest-rerunfailures>=16.0" setuptools osmnx requests
# Install optional packages required for these tests
pip install osmnx requests
- name: Run tests with pytest
run: pytest -n auto tests/test_other_functions.py --durations=0 -v

Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/test-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ jobs:
- name: Install uxsim and dependencies
run: |
python -m pip install --upgrade pip
pip install uxsim
- name: Install pytest other dependencies
run: |
# Install testing dependencies with compatible versions for parallel execution
pip install "pytest>=8.4.0" "pytest-xdist>=3.8.0" "pytest-rerunfailures>=16.0" setuptools
pip install uxsim[dev]
- name: Run tests with pytest
run: pytest -n auto tests/test_verification_sioux_falls.py --durations=0 -v
6 changes: 1 addition & 5 deletions .github/workflows/verify-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ jobs:
- name: Install uxsim and dependencies
run: |
python -m pip install --upgrade pip
pip install .
- name: Install pytest other dependencies
run: |
# Install testing dependencies with compatible versions for parallel execution
pip install "pytest>=8.4.0" "pytest-xdist>=3.8.0" "pytest-rerunfailures>=16.0" setuptools
pip install .[dev]
- name: Run verifications with pytest
run: pytest -n auto tests/test_verification_straight_road.py tests/test_verification_route_choice.py tests/test_verification_node.py tests/test_verification_exceptional.py tests/test_verification_sioux_falls.py tests/test_verification_multilane.py tests/test_verification_taxi.py tests/test_verification_dta_solvers.py tests/test_wrapper_functions.py --durations=0 -v
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ advanced = [
"geopandas>=1.0.0",
"shapely>=2.1.0"
]
dev = [
"pytest>=8.4.0",
"pytest-xdist>=3.8.0",
"pytest-rerunfailures>=16.0",
"pytest-cov",
"setuptools",
"jupyter",
"nbformat"
]

[project.urls]
Homepage = "https://github.com/toruseo/UXsim"
Expand Down
28 changes: 19 additions & 9 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,24 @@ For development purposes only. Users can ignore these files, but they may be inf

Other `test_*.py` tests other functionalities of UXsim.

If a user would like to run these tests locally for development purposes, please organize the code in the following directory structure:
If a user would like to run these tests locally for development purposes, first install UXsim with the development dependencies:
```bash
pip install .[dev]
```
your_project_directory/
├── uxsim/ # The uxsim directory
│ ├── uxsim.py # The main code of UXsim.
│ └── ... # Other files and directories in uxsim
├── test_spam.py # test code
├── ... # Other files or test codes if necessary

For tests that require advanced features (e.g., `osmnx`, `geopandas`, `shapely`, `neatnet`), install the advanced dependencies:
```bash
pip install .[dev,advanced]
```

For tests that require additional optional packages (e.g., `torch`, `gymnasium`, `deap`, `streamlit`), install them manually:
```bash
pip install torch gymnasium deap streamlit requests
```
and run `pytest test_spam.py --durations=0 -v`.
Note that some of the tests require optional packages. For the details, please see yml files in https://github.com/toruseo/UXsim/tree/main/.github/workflows.

Then run the tests:
```bash
pytest tests/test_*.py --durations=0 -v
```

These dependency groups are defined in `pyproject.toml`. For more details, please see the yml files in https://github.com/toruseo/UXsim/tree/main/.github/workflows.