-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
358 Reduce execution time for unit tests (#1098)
- Loading branch information
Showing
67 changed files
with
385 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Integration build | ||
|
||
on: | ||
schedule: | ||
- cron: '0 12 * * *' | ||
|
||
jobs: | ||
scheduled: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 95 | ||
strategy: | ||
matrix: | ||
python-version: [ 3.8, 3.9, '3.10' ] | ||
|
||
steps: | ||
- name: Checkout branch | ||
uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest | ||
pip install .[extra] | ||
pip install .[examples] | ||
pip install .[profilers] | ||
pip install pytest-cov | ||
- name: Test with pytest | ||
run: | | ||
pytest --cov=fedot -s test/integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from typing import List | ||
|
||
from fedot.api.fedot_cli import create_parser, separate_argparse_to_fedot, preprocess_keys, run_fedot, \ | ||
arguments_dicts | ||
from fedot.core.utils import fedot_project_root | ||
|
||
|
||
def call_cli_with_parameters(call_string: List[str]): | ||
""" Function that imitates argparse api call""" | ||
parser = create_parser(arguments_dicts) | ||
parameters = parser.parse_args(call_string) | ||
main_params, fit_params = separate_argparse_to_fedot(parameters) | ||
preprocess_keys(main_params) | ||
preprocess_keys(fit_params) | ||
predictions = run_fedot(parameters, main_params, fit_params, save_predictions=False) | ||
return predictions | ||
|
||
|
||
def test_cli_with_parameters(): | ||
""" Test all parameters used in cli are available from api""" | ||
project_root_path = fedot_project_root() | ||
ts_train_path = project_root_path.joinpath('test/data/simple_time_series.csv') | ||
ts_call = ( | ||
f'--problem ts_forecasting --preset fast_train --timeout 0.1 --depth 3 --arity 3 ' | ||
'--popsize 3 --gen_num 5 --opers lagged linear ridge --tuning 0 ' | ||
f'--cv_folds 2 --val_bl 2 --target sea_height --train {ts_train_path} ' | ||
f'--test {ts_train_path} --for_len 10' | ||
).split() | ||
class_train_path = project_root_path.joinpath('test/data/simple_classification.csv') | ||
class_call = ( | ||
f'--problem classification --train {class_train_path} --test {class_train_path} --target Y ' | ||
'--preset fast_train --timeout 0.1 --depth 3 --arity 3 ' | ||
'--popsize 3 --gen_num 5 --tuning 1' | ||
).split() | ||
|
||
ts_predictions = call_cli_with_parameters(ts_call) | ||
assert ts_predictions is not None | ||
class_predictions = call_cli_with_parameters(class_call) | ||
assert class_predictions is not None |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.