Fix usage of temp_dir fixture

Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
Vladimir Domnich 2022-07-12 12:23:48 +04:00
parent 93a52b4a66
commit f60020f5aa
4 changed files with 27 additions and 23 deletions

10
.gitignore vendored
View file

@ -1,3 +1,6 @@
# ignore IDE files
.vscode
# ignore test results # ignore test results
**/log.html **/log.html
**/output.xml **/output.xml
@ -6,8 +9,13 @@
allure_results/* allure_results/*
xunit_results.xml xunit_results.xml
# ignore pycache under any path # ignore caches under any path
**/__pycache__ **/__pycache__
**/.pytest_cache
# ignore work directories and setup files
.setup
.env
TemporaryDir/* TemporaryDir/*
artifacts/* artifacts/*
docs/* docs/*

View file

@ -8,12 +8,9 @@ OUTPUT_DIR = artifacts/
KEYWORDS_REPO = git@github.com:nspcc-dev/neofs-keywords.git KEYWORDS_REPO = git@github.com:nspcc-dev/neofs-keywords.git
VENVS = $(shell ls -1d venv/*/ | sort -u | xargs basename -a) VENVS = $(shell ls -1d venv/*/ | sort -u | xargs basename -a)
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
DEV_IMAGE_PY ?= registry.spb.yadro.com/tools/pytest-neofs-x86_64:6 DEV_IMAGE_PY ?= registry.spb.yadro.com/tools/pytest-neofs-x86_64:7
SETUP_DIR ?= $(CURDIR)/.setup
ifdef DEVENV_SERVICES_PATH DEV_ENV_DEPLOY_DIR ?= /opt/dev-env
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
ifeq ($(shell uname -s),Darwin) ifeq ($(shell uname -s),Darwin)
DOCKER_NETWORK = --network bridge -p 389:389 -p 636:636 DOCKER_NETWORK = --network bridge -p 389:389 -p 636:636

View file

@ -38,23 +38,21 @@ def check_binary_versions(request):
@pytest.fixture(scope='session') @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') @allure.title('Prepare tmp directory')
def prepare_tmp_dir(): def prepare_tmp_dir():
full_path = f'{os.getcwd()}/{ASSETS_DIR}' full_path = f'{os.getcwd()}/{ASSETS_DIR}'
shutil.rmtree(full_path, ignore_errors=True) shutil.rmtree(full_path, ignore_errors=True)
os.mkdir(full_path) os.mkdir(full_path)
yield yield full_path
shutil.rmtree(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') @pytest.fixture(scope='session')
@allure.title('Prepare wallet and deposit') @allure.title('Prepare wallet and deposit')
def prepare_wallet_and_deposit(init_wallet_with_address): def prepare_wallet_and_deposit(init_wallet_with_address):

View file

@ -30,6 +30,7 @@ NEOFS_CONTRACT = os.getenv("NEOFS_IR_CONTRACTS_NEOFS")
ASSETS_DIR = os.getenv("ASSETS_DIR", "TemporaryDir/") ASSETS_DIR = os.getenv("ASSETS_DIR", "TemporaryDir/")
DEVENV_PATH = os.getenv("DEVENV_PATH", "../neofs-dev-env") 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") 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') NEOGO_EXECUTABLE = os.getenv('NEOGO_EXECUTABLE', 'neo-go')
NEOFS_CLI_EXEC = os.getenv('NEOFS_CLI_EXEC', 'neofs-cli') 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_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_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_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_CONFIG = os.getenv("IR_WALLET_CONFIG", f"{CLI_CONFIGS_PATH}/one_wallet_password.yml")
IR_WALLET_PASS = 'one' IR_WALLET_PASS = os.getenv("IR_WALLET_PASS", "one")
S3_GATE_WALLET_PATH = f"{DEVENV_PATH}/services/s3_gate/wallet.json" S3_GATE_WALLET_PATH = os.getenv("S3_GATE_WALLET_PATH", f"{DEVENV_PATH}/services/s3_gate/wallet.json")
S3_GATE_WALLET_PASS = 's3' S3_GATE_WALLET_PASS = os.getenv("S3_GATE_WALLET_PASS", "s3")
STORAGE_NODE_USER = os.getenv('STORAGE_NODE_USER', 'root') STORAGE_NODE_USER = os.getenv('STORAGE_NODE_USER', 'root')
STORAGE_NODE_PWD = os.getenv('STORAGE_NODE_PWD') STORAGE_NODE_PWD = os.getenv('STORAGE_NODE_PWD')