Skip to content

Commit

Permalink
Merge pull request #610 from LukasVik/get_simulator_name
Browse files Browse the repository at this point in the history
Add get_simulator_name() to ui
  • Loading branch information
kraigher authored Jan 9, 2020
2 parents c6ccaee + c8c1c69 commit 17a63f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
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

0 comments on commit 17a63f3

Please sign in to comment.