Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fixture = None
- target = None
- def load_config(file):
- global target
- if target is None:
- config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), file)
- with open(config_file) as f:
- target = json.load(f)
- return target
- @pytest.fixture
- def app(request):
- global fixture
- browser = request.config.getoption("--browser")
- web_config = load_config(request.config.getoption("--target"))['web']
- if fixture is None or not fixture.is_valid():
- fixture = Application(browser=browser, base_url=web_config['baseURL'])
- fixture.session.ensure_login(user_name=web_config['user_name'], password=web_config['password'])
- return fixture
- @pytest.fixture (scope="session")
- def db(request):
- db_config = load_config(request.config.getoption("--target"))['db']
- dbfixture = Dbfixture(host=db_config['host'], name=db_config['name'], user=db_config['user'], password=db_config['password'])
- def fin():
- dbfixture.destroy()
- request.addfinalizer(fin)
- return dbfixture
- E
- test setup failed
- request = <SubRequest 'app' for <Function 'test_test_ad_group[None:::]'>>
- @pytest.fixture
- def app(request):
- global fixture
- browser = request.config.getoption("--browser")
- > web_config = load_config(request.config.getoption("--target"))['web']
- ..\conftest.py:25:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- ..\conftest.py:17: in load_config
- target = json.load(f)
- c:\python37\Lib\json\__init__.py:296: in load
- parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
- c:\python37\Lib\json\__init__.py:348: in loads
- return _default_decoder.decode(s)
- c:\python37\Lib\json\decoder.py:337: in decode
- obj, end = self.raw_decode(s, idx=_w(s, 0).end())
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <json.decoder.JSONDecoder object at 0x027EEED0>
- s = '{\n web:{\n "baseURL": "http://localhost/addressbook/",\n "user_name": "admin",\n "password": "secret"\n },\n "db":{\n "host": "localhost",\n "name": "addressbook",\n "user": "root",\n "password": ""\n }\n}'
- idx = 0
- def raw_decode(self, s, idx=0):
- """Decode a JSON document from ``s`` (a ``str`` beginning with
- a JSON document) and return a 2-tuple of the Python
- representation and the index in ``s`` where the document ended.
- This can be used to decode a JSON document from a string that may
- have extraneous data at the end.
- """
- try:
- > obj, end = self.scan_once(s, idx)
- E json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 2 column 3 (char 4)
- c:\python37\Lib\json\decoder.py:353: JSONDecodeError
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement