added -s option to test to skip time consuming tests. also updated readme accordingly
This commit is contained in:
@ -12,7 +12,12 @@ The most import definitions are the BasePattern, and BaseRecipe, which define th
|
||||
The way to run a MEOW system is to create and MeowRunner instance, found in **core/runner.py**. This will take 1 or more Monitors, 1 or more Handlers, and 1 or more Conductors. In turn, these will listen for events, respond to events, and execute any analysis identified. Examples of how this can be run can be found in **tests/testRunner.py**
|
||||
|
||||
## Testing
|
||||
Pytest unittests are provided within the 'tests directory, as well as a script **test_all.sh** for calling all test scripts from a single command. Individual test scripts can be started using:
|
||||
Pytest unittests are provided within the 'tests directory, as well as a script **test_all.sh** for calling all test scripts from a single command. This can be
|
||||
run as:
|
||||
|
||||
test_all.sh -s
|
||||
|
||||
This will skip the more time consuming tests if you just need quick feedback. Without the -s argument then all tests will be run. Individual test scripts can be started using:
|
||||
|
||||
pytest test_runner.py::MeowTests -W ignore::DeprecationWarning
|
||||
|
||||
|
@ -7,15 +7,31 @@ starting_working_dir=$(pwd)
|
||||
script_name=$(basename "$0")
|
||||
script_dir=$(dirname "$(realpath "$0")")
|
||||
|
||||
skip_long_tests=0
|
||||
|
||||
for arg in "$@"
|
||||
do
|
||||
echo "Given arg: $arg";
|
||||
if [[ $arg == -s ]]
|
||||
then
|
||||
echo "skippy the kangaroo"
|
||||
skip_long_tests=1
|
||||
fi
|
||||
done
|
||||
|
||||
cd $script_dir
|
||||
|
||||
# Gather all other test files and run pytest
|
||||
search_dir=.
|
||||
for entry in "$search_dir"/*
|
||||
do
|
||||
if [[ $entry == ./test* ]] && [[ -f $entry ]] && [[ $entry != ./$script_name ]] && [[ $entry != ./shared.py ]];
|
||||
if [[ $entry == ./test* ]] \
|
||||
&& [[ -f $entry ]] \
|
||||
&& [[ $entry != ./$script_name ]] \
|
||||
&& [[ $entry != ./shared.py ]];
|
||||
then
|
||||
pytest $entry "-W ignore::DeprecationWarning"
|
||||
SKIP_LONG=$skip_long_tests pytest $entry "-W ignore::DeprecationWarning"
|
||||
# SKIP_LONG=$skip_long_tests pytest $entry
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -3,10 +3,11 @@ import io
|
||||
import importlib
|
||||
import os
|
||||
import unittest
|
||||
|
||||
|
||||
from random import shuffle
|
||||
from shutil import copy
|
||||
from time import sleep
|
||||
from warnings import warn
|
||||
|
||||
from meow_base.core.base_conductor import BaseConductor
|
||||
from meow_base.core.base_handler import BaseHandler
|
||||
@ -116,6 +117,7 @@ recipe_generator = JupyterNotebookRecipe(
|
||||
requirements={recipe_generator_key: recipe_generator_req}
|
||||
)
|
||||
|
||||
|
||||
class MeowTests(unittest.TestCase):
|
||||
def setUp(self)->None:
|
||||
super().setUp()
|
||||
@ -970,6 +972,10 @@ class MeowTests(unittest.TestCase):
|
||||
|
||||
# Test some actual scientific analysis, but in a simple progression
|
||||
def testScientificAnalysisAllGood(self)->None:
|
||||
if os.environ["SKIP_LONG"]:
|
||||
warn("Skipping testScientificAnalysisAllGood")
|
||||
return
|
||||
|
||||
patterns = {
|
||||
'pattern_check': pattern_check,
|
||||
'pattern_segment': pattern_segment,
|
||||
@ -1090,6 +1096,10 @@ class MeowTests(unittest.TestCase):
|
||||
|
||||
# Test some actual scientific analysis, in a predicatable loop
|
||||
def testScientificAnalysisPredictableLoop(self)->None:
|
||||
if os.environ["SKIP_LONG"]:
|
||||
warn("Skipping testScientificAnalysisPredictableLoop")
|
||||
return
|
||||
|
||||
patterns = {
|
||||
'pattern_check': pattern_check,
|
||||
'pattern_segment': pattern_segment,
|
||||
@ -1225,6 +1235,10 @@ class MeowTests(unittest.TestCase):
|
||||
|
||||
# Test some actual scientific analysis, in an unpredicatable loop
|
||||
def testScientificAnalysisRandomLoop(self)->None:
|
||||
if os.environ["SKIP_LONG"]:
|
||||
warn("Skipping testScientificAnalysisRandomLoop")
|
||||
return
|
||||
|
||||
pattern_regenerate_random = FileEventPattern(
|
||||
"pattern_regenerate_random",
|
||||
os.path.join("foam_ct_data_discarded", "*"),
|
||||
@ -1373,6 +1387,10 @@ class MeowTests(unittest.TestCase):
|
||||
|
||||
# Test some actual scientific analysis, in an unpredicatable loop
|
||||
def testScientificAnalysisMassiveRandomLoop(self)->None:
|
||||
if os.environ["SKIP_LONG"]:
|
||||
warn("Skipping testScientificAnalysisMassiveRandomLoop")
|
||||
return
|
||||
|
||||
pattern_regenerate_random = FileEventPattern(
|
||||
"pattern_regenerate_random",
|
||||
os.path.join("foam_ct_data_discarded", "*"),
|
||||
|
Reference in New Issue
Block a user