ext,tests: Fix --figures flag when using ./main.py list
Now the "tests/main.py" script will accept the `--fixtures` flag when using the `list` command. This will only list the fixtures needed. To have this implemented `__str__` for the `Fixture` class has been implemented. Change-Id: I4bba26e923c8b0001163726637f2e48c801e92b1
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
# Authors: Sean Wilson
|
||||
|
||||
import testlib.helper as helper
|
||||
from testlib.configuration import constants
|
||||
|
||||
|
||||
class SkipException(Exception):
|
||||
@@ -79,6 +80,9 @@ class Fixture(object):
|
||||
def teardown(self, testitem):
|
||||
pass
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.name} fixture"
|
||||
|
||||
def set_global(self):
|
||||
self._is_global = True
|
||||
|
||||
|
||||
@@ -253,6 +253,8 @@ def do_list():
|
||||
qrunner.list_tests()
|
||||
elif configuration.config.all_tags:
|
||||
qrunner.list_tags()
|
||||
elif configuration.config.fixtures:
|
||||
qrunner.list_fixtures()
|
||||
else:
|
||||
qrunner.list_suites()
|
||||
qrunner.list_tests()
|
||||
|
||||
@@ -55,6 +55,13 @@ class QueryRunner(object):
|
||||
for test in suite:
|
||||
log.test_log.message(test.uid, machine_readable=True)
|
||||
|
||||
def list_fixtures(self):
|
||||
log.test_log.message(terminal.separator())
|
||||
log.test_log.message('Listing all Test Fixtures.', bold=True)
|
||||
log.test_log.message(terminal.separator())
|
||||
for fixture in self.schedule.all_fixtures():
|
||||
log.test_log.message(fixture, machine_readable=True)
|
||||
|
||||
def list_suites(self):
|
||||
log.test_log.message(terminal.separator())
|
||||
log.test_log.message("Listing all Test Suites.", bold=True)
|
||||
|
||||
Reference in New Issue
Block a user