-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fixture for caching everest test-data example
- Loading branch information
Showing
3 changed files
with
99 additions
and
75 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 |
---|---|---|
@@ -1,34 +1,21 @@ | ||
import sys | ||
from unittest.mock import PropertyMock, patch | ||
from pathlib import Path | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
||
from everest.bin.visualization_script import visualization_entry | ||
from everest.config import EverestConfig | ||
from everest.detached import ServerStatus | ||
from tests.everest.utils import capture_streams, relpath | ||
|
||
CONFIG_PATH = relpath( | ||
"..", "..", "test-data", "everest", "math_func", "config_advanced.yml" | ||
) | ||
CACHED_SEBA_FOLDER = relpath("test_data", "cached_results_config_advanced") | ||
from tests.everest.utils import capture_streams | ||
|
||
|
||
@patch.object( | ||
EverestConfig, | ||
"optimization_output_dir", | ||
new_callable=PropertyMock, | ||
return_value=CACHED_SEBA_FOLDER, | ||
) | ||
@patch( | ||
"everest.bin.visualization_script.everserver_status", | ||
return_value={"status": ServerStatus.completed}, | ||
) | ||
@pytest.mark.skipif(sys.version_info.major < 3, reason="requires python3 or higher") | ||
def test_visualization_entry( | ||
opt_dir_mock, | ||
server_status_mock, | ||
): | ||
def test_visualization_entry(_, cached_example): | ||
config_path, config_file, _ = cached_example("math_func/config_advanced.yml") | ||
with capture_streams() as (out, _): | ||
visualization_entry([CONFIG_PATH]) | ||
visualization_entry([str(Path(config_path) / config_file)]) | ||
assert "No visualization plugin installed!" in out.getvalue() |
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