Skip to content

Split Tests #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 7, 2022
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
30 changes: 30 additions & 0 deletions .github/workflows/run-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Run SpatialPy Integration Tests

on:
push:
branches: [staging, develop]

jobs:
run-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]

steps:
- name: Initialize environment
uses: actions/checkout@v2

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.7'

- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python3 -m pip install coverage

- name: Run tests
run: coverage run test/run_integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
python3 -m pip install coverage

- name: Run tests
run: coverage run test/run_tests.py
run: coverage run test/run_unit_tests.py
6 changes: 0 additions & 6 deletions test/run_tests.py → test/run_integration_tests.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,11 @@
print('Running tests in develop mode. Appending repository directory to system path.')
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

import test_species
import test_parameter
import test_reaction
import test_model
import test_solver
#import test_mincde

modules = [
test_species,
test_parameter,
test_reaction,
test_model,
test_solver,
#test_mincde,
Expand Down
51 changes: 51 additions & 0 deletions test/run_unit_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env python3
'''
SpatialPy is a Python 3 package for simulation of
spatial deterministic/stochastic reaction-diffusion-advection problems
Copyright (C) 2019 - 2022 SpatialPy developers.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU GENERAL PUBLIC LICENSE Version 3 for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''

import unittest, sys, os
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('-m', '--mode', default='develop', choices=['develop', 'release'],
help='Run unit tests in develop mode or release mode.')

if __name__ == '__main__':
args = parser.parse_args()
if args.mode == 'develop':
print('Running unit tests in develop mode. Appending repository directory to system path.')
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

import test_species
import test_parameter
import test_reaction

modules = [
test_species,
test_parameter,
test_reaction
]

for module in modules:
suite = unittest.TestLoader().loadTestsFromModule(module)
runner = unittest.TextTestRunner(failfast=args.mode == 'develop')

print("Executing: {}".format(module))
result = runner.run(suite)
print('=' * 70)
if not result.wasSuccessful():
sys.exit(not result.wasSuccessful())