Skip to content
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

Add get_simulator_name() to ui #610

Merged
merged 1 commit into from
Jan 9, 2020
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
4 changes: 4 additions & 0 deletions tests/unit/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,10 @@ def test_get_testbench_files(self):
sorted(expected, key=lambda x: x.name),
)

def test_get_simulator_name(self):
ui = self._create_ui()
self.assertEqual(ui.get_simulator_name(), "mock")

def _create_ui(self, *args):
""" Create an instance of the VUnit public interface class """
with mock.patch(
Expand Down
10 changes: 10 additions & 0 deletions vunit/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,3 +1049,13 @@ def get_implementation_subset(self, source_files):
for source_file in source_files
]
)

def get_simulator_name(self):
"""
Get the name of the simulator used.

Will return None if no simulator was found.
"""
if self._simulator_class is None:
return None
return self._simulator_class.name