From f60020f5aa3b04cc68a3c489385a63a691429734 Mon Sep 17 00:00:00 2001 From: Vladimir Domnich Date: Tue, 12 Jul 2022 12:23:48 +0400 Subject: [PATCH] Fix usage of temp_dir fixture Signed-off-by: Vladimir Domnich --- .gitignore | 10 +++++++++- Makefile | 9 +++------ pytest_tests/testsuites/conftest.py | 16 +++++++--------- robot/variables/common.py | 15 ++++++++------- 4 files changed, 27 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index f026368..0e454b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# ignore IDE files +.vscode + # ignore test results **/log.html **/output.xml @@ -6,8 +9,13 @@ allure_results/* xunit_results.xml -# ignore pycache under any path +# ignore caches under any path **/__pycache__ +**/.pytest_cache + +# ignore work directories and setup files +.setup +.env TemporaryDir/* artifacts/* docs/* diff --git a/Makefile b/Makefile index 0119af0..029d148 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,9 @@ OUTPUT_DIR = artifacts/ KEYWORDS_REPO = git@github.com:nspcc-dev/neofs-keywords.git VENVS = $(shell ls -1d venv/*/ | sort -u | xargs basename -a) ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -DEV_IMAGE_PY ?= registry.spb.yadro.com/tools/pytest-neofs-x86_64:6 - -ifdef DEVENV_SERVICES_PATH - RUN_OPTIONS += -v $(DEVENV_SERVICES_PATH)/chain/node-wallet.json:/wallets/mainnet.json -e MAINNET_WALLET_PATH_HOST="/wallets/mainnet.json" - RUN_OPTIONS += -v $(DEVENV_SERVICES_PATH)/ir/wallet01.json:/wallets/ir.json -e IR_WALLET_PATH="/wallets/ir.json" -endif +DEV_IMAGE_PY ?= registry.spb.yadro.com/tools/pytest-neofs-x86_64:7 +SETUP_DIR ?= $(CURDIR)/.setup +DEV_ENV_DEPLOY_DIR ?= /opt/dev-env ifeq ($(shell uname -s),Darwin) DOCKER_NETWORK = --network bridge -p 389:389 -p 636:636 diff --git a/pytest_tests/testsuites/conftest.py b/pytest_tests/testsuites/conftest.py index c330388..e0d0b98 100644 --- a/pytest_tests/testsuites/conftest.py +++ b/pytest_tests/testsuites/conftest.py @@ -38,23 +38,21 @@ def check_binary_versions(request): @pytest.fixture(scope='session') -@allure.title('Init wallet with address') -def init_wallet_with_address(): - full_path = f'{os.getcwd()}/{ASSETS_DIR}' - os.mkdir(full_path) - - yield wallet.init_wallet(ASSETS_DIR) - - @allure.title('Prepare tmp directory') def prepare_tmp_dir(): full_path = f'{os.getcwd()}/{ASSETS_DIR}' shutil.rmtree(full_path, ignore_errors=True) os.mkdir(full_path) - yield + yield full_path shutil.rmtree(full_path) +@pytest.fixture(scope='session') +@allure.title('Init wallet with address') +def init_wallet_with_address(prepare_tmp_dir): + yield wallet.init_wallet(ASSETS_DIR) + + @pytest.fixture(scope='session') @allure.title('Prepare wallet and deposit') def prepare_wallet_and_deposit(init_wallet_with_address): diff --git a/robot/variables/common.py b/robot/variables/common.py index 7797796..fcf11ad 100644 --- a/robot/variables/common.py +++ b/robot/variables/common.py @@ -30,6 +30,7 @@ NEOFS_CONTRACT = os.getenv("NEOFS_IR_CONTRACTS_NEOFS") ASSETS_DIR = os.getenv("ASSETS_DIR", "TemporaryDir/") DEVENV_PATH = os.getenv("DEVENV_PATH", "../neofs-dev-env") +CLI_CONFIGS_PATH = os.getenv("CLI_CONFIGS_PATH", f"{os.getcwd()}/neofs_cli_configs") MORPH_MAGIC = os.getenv("MORPH_MAGIC") @@ -79,16 +80,16 @@ NEOFS_NETMAP = [i['rpc'] for i in NEOFS_NETMAP_DICT.values()] NEOGO_EXECUTABLE = os.getenv('NEOGO_EXECUTABLE', 'neo-go') NEOFS_CLI_EXEC = os.getenv('NEOFS_CLI_EXEC', 'neofs-cli') -WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/empty_passwd.yml" +WALLET_CONFIG = f"{CLI_CONFIGS_PATH}/empty_passwd.yml" MAINNET_WALLET_PATH = os.getenv("MAINNET_WALLET_PATH", f"{DEVENV_PATH}/services/chain/node-wallet.json") -MAINNET_WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/one_wallet_password.yml" +MAINNET_WALLET_CONFIG = f"{CLI_CONFIGS_PATH}/one_wallet_password.yml" MAINNET_SINGLE_ADDR = 'NfgHwwTi3wHAS8aFAN243C5vGbkYDpqLHP' -MAINNET_WALLET_PASS = 'one' +MAINNET_WALLET_PASS = os.getenv("MAINNET_WALLET_PASS", "one") IR_WALLET_PATH = os.getenv("IR_WALLET_PATH", f"{DEVENV_PATH}/services/ir/wallet01.json") -IR_WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/one_wallet_password.yml" -IR_WALLET_PASS = 'one' -S3_GATE_WALLET_PATH = f"{DEVENV_PATH}/services/s3_gate/wallet.json" -S3_GATE_WALLET_PASS = 's3' +IR_WALLET_CONFIG = os.getenv("IR_WALLET_CONFIG", f"{CLI_CONFIGS_PATH}/one_wallet_password.yml") +IR_WALLET_PASS = os.getenv("IR_WALLET_PASS", "one") +S3_GATE_WALLET_PATH = os.getenv("S3_GATE_WALLET_PATH", f"{DEVENV_PATH}/services/s3_gate/wallet.json") +S3_GATE_WALLET_PASS = os.getenv("S3_GATE_WALLET_PASS", "s3") STORAGE_NODE_USER = os.getenv('STORAGE_NODE_USER', 'root') STORAGE_NODE_PWD = os.getenv('STORAGE_NODE_PWD')