diff options
author | Saw-jan Gurung <saw.jan.grg3e@gmail.com> | 2021-12-30 11:36:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-30 11:36:20 +0300 |
commit | 973ae2ab82ab9331d73fed978d94be3365a8db7c (patch) | |
tree | 0c4509768d0411f2cbd9379a9e61027fedaafb1b /test | |
parent | 56057b563d117395452945742703c5946c20bd7e (diff) |
cleanup test server in afterScenario (#9310)
Diffstat (limited to 'test')
-rw-r--r-- | test/gui/shared/scripts/bdd_hooks.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py index 848b64580..e5eb6dd13 100644 --- a/test/gui/shared/scripts/bdd_hooks.py +++ b/test/gui/shared/scripts/bdd_hooks.py @@ -107,3 +107,16 @@ def hook(context): shutil.rmtree(file_path) except Exception as e: print('Failed to delete %s. Reason: %s' % (file_path, e)) + + # cleanup test server + req = urllib.request.Request( + os.path.join(context.userData['middlewareUrl'], 'cleanup'), + headers={"Content-Type": "application/json"}, + method='POST', + ) + try: + urllib.request.urlopen(req) + except urllib.error.HTTPError as e: + raise Exception( + "Step execution through test middleware failed. Error: " + e.read().decode() + ) |