Deleted Added
sdiff udiff text old ( 12882:dd87d7f2f3e5 ) new ( 14141:b3ceff47211a )
full compact
1# Copyright (c) 2019 ARM Limited
2# All rights reserved
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license
9# terms below provided that you ensure that this notice is replicated
10# unmodified and in its entirety in all distributions of the software,
11# modified or unmodified, in source code or in binary form.
12#
13# Copyright (c) 2017 Mark D. Hill and David A. Wood
14# All rights reserved.
15#
16# Redistribution and use in source and binary forms, with or without
17# modification, are permitted provided that the following conditions are
18# met: redistributions of source code must retain the above copyright
19# notice, this list of conditions and the following disclaimer;
20# redistributions in binary form must reproduce the above copyright

--- 165 unchanged lines hidden (view full) ---

186 return self.metadata.tags
187
188
189class LoadedLibrary(LoadedTestable):
190 '''
191 Wraps a collection of all loaded test suites and
192 provides utility functions for accessing fixtures.
193 '''
194 def __init__(self, suites):
195 LoadedTestable.__init__(self, suites)
196
197 def _generate_metadata(self):
198 return LibraryMetadata( **{
199 'name': 'Test Library',
200 'status': Status.Unscheduled,
201 'result': Result(Result.NotRun)
202 })
203
204 def __iter__(self):
205 '''
206 :returns: an iterator over contained :class:`TestSuite` objects.
207 '''
208 return iter(self.obj)
209
210 def all_fixtures(self):
211 '''
212 :returns: an interator overall all global, suite,
213 and test fixtures
214 '''
215 return itertools.chain(itertools.chain(
216 *(suite.fixtures for suite in self.obj)),
217 *(self.test_fixtures(suite) for suite in self.obj)
218 )
219
220 def test_fixtures(self, suite):
221 '''
222 :returns: an interator over all fixtures of each
223 test contained in the given suite
224 '''
225 return itertools.chain(*(test.fixtures for test in suite))
226
227 @property
228 def fixtures(self):
229 global_fixtures = []
230 for fixture in self.all_fixtures():
231 if fixture.is_global():
232 global_fixtures.append(fixture)
233 return global_fixtures
234
235 @property
236 def uid(self):
237 return self.name
238
239 @property
240 def suites(self):
241 return self.obj
242
243 @suites.setter
244 def suites(self, suites):
245 self.obj = suites