2023-10-09 09:38:48 +00:00
|
|
|
import allure
|
2023-08-04 18:27:03 +00:00
|
|
|
import pytest
|
2023-11-30 11:42:17 +00:00
|
|
|
import logging
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
from driver.server import SquishServer
|
|
|
|
|
2023-11-30 11:42:17 +00:00
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
@pytest.fixture(scope='session')
|
|
|
|
def start_squish_server():
|
2023-11-30 13:07:26 +00:00
|
|
|
LOG.info('Starting Squish Server...')
|
2023-11-30 11:42:17 +00:00
|
|
|
server = SquishServer()
|
|
|
|
server.stop()
|
|
|
|
try:
|
|
|
|
server.start()
|
|
|
|
server.wait()
|
|
|
|
yield server
|
|
|
|
except Exception as err:
|
2023-11-30 13:07:26 +00:00
|
|
|
LOG.error('Failed to start Squish Server: %s', err)
|
2023-11-30 11:42:17 +00:00
|
|
|
pytest.exit(err)
|
|
|
|
finally:
|
|
|
|
LOG.info('Stopping Squish Server...')
|
|
|
|
server.stop()
|
|
|
|
if server.config.exists():
|
|
|
|
allure.attach.file(str(server.config), 'Squish server config')
|
|
|
|
server.config.unlink()
|