Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1070 from DKilkenny/mm_view
Added ability user to set resolution of view_mm in command line
- Loading branch information
Showing
5 changed files
with
45 additions
and
50 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
28 changes: 0 additions & 28 deletions
28
openmdao/visualization/meta_model_viewer/tests/known_data_point_files/unstructured_test.py
This file was deleted.
Oops, something went wrong.
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
35 changes: 35 additions & 0 deletions
35
openmdao/visualization/meta_model_viewer/tests/test_view_mm_cmd_line.py
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,35 @@ | ||
""" Unit tests for structured metamodels in view_mm. """ | ||
import unittest | ||
import subprocess | ||
import os | ||
|
||
try: | ||
import bokeh | ||
except ImportError: | ||
bokeh = None | ||
import openmdao.test_suite.test_examples.meta_model_examples.structured_meta_model_example as example | ||
|
||
@unittest.skipUnless(bokeh, "Bokeh is required") | ||
class ViewMMCommandLineTest(unittest.TestCase): | ||
|
||
def test_unspecified_metamodel(self): | ||
script = os.path.join(os.path.dirname(__file__), 'example.py') | ||
cmd = 'openmdao view_mm {}'.format(script) | ||
output = subprocess.check_output(cmd.split()).decode('utf-8', 'ignore') | ||
expected_output = ("Metamodel not specified. " | ||
"Try one of the following: ['interp1', 'interp2'].") | ||
self.assertTrue( | ||
expected_output in output, | ||
msg='Metamodel was specified when it should not have been. Check example.') | ||
|
||
def test_invalid_metamodel(self): | ||
script = os.path.abspath(example.__file__).replace('.pyc', '.py') # PY2 | ||
cmd = 'openmdao view_mm {} -m {}'.format(script, 'interp') | ||
output = subprocess.check_output(cmd.split()).decode('utf-8', 'ignore') | ||
expected_output = '\n'.join([ | ||
"Metamodel 'interp' not found.", | ||
" Try one of the following: ['mm']." | ||
]) | ||
self.assertTrue( | ||
expected_output in output.replace('\r', ''), | ||
msg='Metamodel was found when it should not have. Check example.') |