Robot Framework
fixture.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 def create_fixture(fixture, parent, type):
17  # TestCase and TestSuite have 'fixture_class', Keyword doesn't.
18  fixture_class = getattr(parent, 'fixture_class', parent.__class__)
19  if fixture is None:
20  fixture = fixture_class(None, parent=parent, type=type)
21  elif isinstance(fixture, fixture_class):
22  fixture.parent = parent
23  fixture.type = type
24  else:
25  raise TypeError("Only %s objects accepted, got %s."
26  % (fixture_class.__name__, fixture.__class__.__name__))
27  return fixture
def create_fixture(fixture, parent, type)
Definition: fixture.py:16