From f4845c42294474646f30d2789698453f953c8da8 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Sun, 17 Apr 2022 12:03:24 +0800 Subject: [PATCH] fix #1233: parse upload info with session variables --- docs/CHANGELOG.md | 3 ++- httprunner/ext/uploader/__init__.py | 7 ++++++- httprunner/parser.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f676a94d..a46cf878 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,8 +2,9 @@ ## 3.1.9 (2022-04-17) -- fix #1247: catch exceptions caused by GA report failure +- fix #1233: parse upload info with session variables - fix #1246: catch exceptions when getting socket address failed +- fix #1247: catch exceptions caused by GA report failure ## 3.1.8 (2022-03-22) diff --git a/httprunner/ext/uploader/__init__.py b/httprunner/ext/uploader/__init__.py index c375c4d5..2a68e547 100644 --- a/httprunner/ext/uploader/__init__.py +++ b/httprunner/ext/uploader/__init__.py @@ -47,7 +47,7 @@ import sys from typing import Text from httprunner.models import TStep, FunctionsMapping -from httprunner.parser import parse_variables_mapping +from httprunner.parser import parse_variables_mapping, parse_data from loguru import logger try: @@ -101,6 +101,11 @@ def prepare_upload_step(step: TStep, functions: FunctionsMapping): if not step.request.upload: return + # parse upload info + step.request.upload = parse_data( + step.request.upload, step.variables, functions + ) + ensure_upload_ready() params_list = [] for key, value in step.request.upload.items(): diff --git a/httprunner/parser.py b/httprunner/parser.py index 457d8806..8e8fa4bb 100644 --- a/httprunner/parser.py +++ b/httprunner/parser.py @@ -2,7 +2,7 @@ import ast import builtins import re import os -from typing import Any, Set, Text, Callable, List, Dict, Union +from typing import Any, Set, Text, Callable, List, Dict from loguru import logger from sentry_sdk import capture_exception