From c8c1c693075ac02b4f3e66ada5d4ea7765461497 Mon Sep 17 00:00:00 2001 From: Lukas Vik <10241915+LukasVik@users.noreply.github.com> Date: Thu, 9 Jan 2020 13:53:08 +0100 Subject: [PATCH] Add get_simulator_name() to ui --- tests/unit/test_ui.py | 4 ++++ vunit/ui/__init__.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/tests/unit/test_ui.py b/tests/unit/test_ui.py index cacf1620d..76c6ab078 100644 --- a/tests/unit/test_ui.py +++ b/tests/unit/test_ui.py @@ -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( diff --git a/vunit/ui/__init__.py b/vunit/ui/__init__.py index b18994973..f1f796767 100644 --- a/vunit/ui/__init__.py +++ b/vunit/ui/__init__.py @@ -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