2022-01-24 09:57:40 +01:00
|
|
|
import os
|
|
|
|
|
|
|
|
from steps import common
|
2022-12-05 15:10:50 +01:00
|
|
|
from steps import osc
|
|
|
|
from steps import podman
|
2022-01-24 09:57:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
def before_step(context, step):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def after_step(context, step):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def before_scenario(context, scenario):
|
2022-12-05 15:10:50 +01:00
|
|
|
pass
|
2022-01-24 09:57:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
def after_scenario(context, scenario):
|
2022-12-05 15:10:50 +01:00
|
|
|
if "destructive" in scenario.tags:
|
|
|
|
# start a new container after a destructive test
|
|
|
|
context.podman.kill()
|
|
|
|
context.podman = podman.Podman()
|
|
|
|
context.osc.clear()
|
2022-01-24 09:57:40 +01:00
|
|
|
common.check_exit_code(context)
|
|
|
|
|
|
|
|
|
|
|
|
def before_feature(context, feature):
|
2022-12-05 15:10:50 +01:00
|
|
|
pass
|
2022-01-24 09:57:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
def after_feature(context, feature):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def after_tag(context, tag):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def before_all(context):
|
|
|
|
# convert path to osc executable to an absolute path to avoid relative path issues
|
|
|
|
if "osc" in context.config.userdata:
|
|
|
|
context.config.userdata["osc"] = os.path.abspath(os.path.expanduser(context.config.userdata["osc"]))
|
|
|
|
|
|
|
|
# absolute path to .../behave/fixtures
|
|
|
|
context.fixtures = os.path.join(os.path.dirname(__file__), "..", "fixtures")
|
|
|
|
|
2022-12-05 15:10:50 +01:00
|
|
|
context.podman = podman.Podman()
|
|
|
|
context.osc = osc.Osc(context)
|
2022-01-24 09:57:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
def after_all(context):
|
2022-12-05 15:10:50 +01:00
|
|
|
del context.osc
|
|
|
|
context.podman.kill()
|
|
|
|
del context.podman
|
2022-01-24 09:57:40 +01:00
|
|
|
del context.fixtures
|