Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all wallets are created in the same way, fix unused imports #965

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions neofs-testlib/neofs_testlib/cli/neofs_cli/control.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Optional

from neofs_testlib.cli.cli_command import CliCommand
from neofs_testlib.shell import CommandResult

Expand Down
2 changes: 0 additions & 2 deletions neofs-testlib/neofs_testlib/cli/neofs_lens/objects.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Optional

from neofs_testlib.cli.cli_command import CliCommand
from neofs_testlib.shell import CommandResult

Expand Down
2 changes: 0 additions & 2 deletions neofs-testlib/neofs_testlib/cli/neofs_lens/write_cache.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Optional

from neofs_testlib.cli.cli_command import CliCommand
from neofs_testlib.shell import CommandResult

Expand Down
2 changes: 1 addition & 1 deletion neofs-testlib/neofs_testlib/hosting/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
from datetime import datetime
from typing import Any, Optional
from typing import Optional

from neofs_testlib.hosting.config import CLIConfig, HostConfig, ServiceConfig
from neofs_testlib.shell.interfaces import Shell
Expand Down
11 changes: 4 additions & 7 deletions neofs-testlib/neofs_testlib_tests/pytest/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
import pytest
import requests
from botocore.config import Config
from helpers.common import DEFAULT_OBJECT_OPERATION_TIMEOUT, DEFAULT_REST_OPERATION_TIMEOUT
from helpers.common import DEFAULT_OBJECT_OPERATION_TIMEOUT
from helpers.wallet_helpers import create_wallet
from neofs_testlib.env.env import NeoFSEnv, NodeWallet
from neofs_testlib.utils.wallet import get_last_public_key_from_wallet, init_wallet
from neofs_testlib.utils.wallet import get_last_public_key_from_wallet


def _run_with_passwd(cmd: str, password: str) -> str:
Expand Down Expand Up @@ -42,11 +43,7 @@ def neofs_env(request):

@pytest.fixture
def wallet() -> NodeWallet:
wallet_name = f"wallet-{str(uuid.uuid4())}.json"
wallet_path = os.path.join(os.getcwd(), wallet_name)
wallet_password = "password"
wallet_address = init_wallet(wallet_path, wallet_password)
return NodeWallet(path=wallet_path, address=wallet_address, password=wallet_password)
return create_wallet()


@pytest.fixture
Expand Down
3 changes: 1 addition & 2 deletions neofs-testlib/neofs_testlib_tests/unit/test_hosting.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from unittest import TestCase

import docker
from neofs_testlib.hosting import CLIConfig, DockerHost, HostConfig, Hosting, ServiceConfig
from neofs_testlib.hosting import CLIConfig, Hosting, ServiceConfig


class TestHosting(TestCase):
Expand Down
1 change: 0 additions & 1 deletion pytest_tests/lib/helpers/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import datetime
import os
import uuid

import yaml

Expand Down
1 change: 0 additions & 1 deletion pytest_tests/lib/helpers/rest_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import allure
import requests
from helpers.aws_cli_client import LONG_TIMEOUT
from helpers.cli_helpers import _cmd_run
from helpers.common import (
DEFAULT_OBJECT_OPERATION_TIMEOUT,
Expand Down
2 changes: 0 additions & 2 deletions pytest_tests/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import datetime
import logging
import os
import shutil
import time
from pathlib import Path

import allure
Expand Down
1 change: 0 additions & 1 deletion pytest_tests/tests/container/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from helpers.wellknown_acl import PRIVATE_ACL_F, PUBLIC_ACL
from neofs_env.neofs_env_test_base import NeofsEnvTestBase
from neofs_testlib.env.env import NeoFSEnv, NodeWallet, StorageNode
from tenacity import retry, stop_after_attempt, wait_fixed


def object_should_be_gc_marked(neofs_env: NeoFSEnv, node: StorageNode, cid: str, oid: str):
Expand Down
1 change: 0 additions & 1 deletion pytest_tests/tests/load/test_load.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pytest
from neofs_env.neofs_env_test_base import NeofsEnvTestBase
from neofs_testlib.env.env import XK6

Expand Down
2 changes: 0 additions & 2 deletions pytest_tests/tests/metrics/test_sn_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
import logging
import os
import sys
from importlib.resources import files

import allure
import neofs_env.neofs_epoch as neofs_epoch
import pytest
import yaml
from helpers.common import SIMPLE_OBJECT_SIZE
from helpers.container import create_container, delete_container
from helpers.file_helper import generate_file
Expand Down
3 changes: 0 additions & 3 deletions pytest_tests/tests/network/test_deployment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import time

import allure
import pytest
from helpers.common import SIMPLE_OBJECT_SIZE
from helpers.container import create_container
from helpers.file_helper import generate_file, get_file_hash
Expand Down
1 change: 0 additions & 1 deletion pytest_tests/tests/network/test_ir_controls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import time
from typing import Union

import allure
Expand Down
2 changes: 1 addition & 1 deletion pytest_tests/tests/object/test_object_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
from helpers.common import STORAGE_GC_TIME
from helpers.complex_object_actions import get_link_object, get_nodes_with_object, get_object_chunks
from helpers.container import create_container, get_container
from helpers.container import create_container
from helpers.file_helper import generate_file
from helpers.grpc_responses import (
LIFETIME_REQUIRED,
Expand Down
12 changes: 3 additions & 9 deletions pytest_tests/tests/payment/test_deposit_withdrawal.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
import allure
from helpers.wallet_helpers import (
create_wallet,
get_wallet_balance,
wait_for_correct_neofs_balance,
wait_for_correct_wallet_balance,
)
from neofs_testlib.env.env import NeoFSEnv, NodeWallet
from neofs_testlib.utils import wallet as wallet_utils
from neofs_testlib.env.env import NeoFSEnv


class TestDepositWithdrawal:
def test_deposit_withdrawal(self, neofs_env_with_mainchain: NeoFSEnv):
neofs_env = neofs_env_with_mainchain

with allure.step("Create wallet for deposits/withdrawals"):
wallet = NodeWallet(
path=neofs_env._generate_temp_file(neofs_env._env_dir, prefix="deposit_withdrawal_test_wallet"),
address="",
password=neofs_env.default_password,
)
wallet_utils.init_wallet(wallet.path, wallet.password)
wallet.address = wallet_utils.get_last_address_from_wallet(wallet.path, wallet.password)
wallet = create_wallet("deposit_withdrawal_test_wallet")
neo_go_wallet_config = neofs_env.generate_neo_go_config(wallet)
cli_wallet_config = neofs_env.generate_cli_config(wallet)

Expand Down
7 changes: 2 additions & 5 deletions pytest_tests/tests/s3/test_s3_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
set_bucket_versioning,
verify_acls,
)
from neofs_testlib.env.env import NodeWallet
from neofs_testlib.utils.wallet import init_wallet
from helpers.wallet_helpers import create_wallet
from s3 import s3_bucket, s3_object
from s3.s3_base import TestNeofsS3Base

Expand Down Expand Up @@ -585,9 +584,7 @@ def test_s3_put_object(self, bucket, complex_object_size, simple_object_size):
def prepare_two_wallets(self, default_wallet, client_shell):
self.main_wallet = default_wallet
self.main_public_key = get_wallet_public_key(self.main_wallet.path, WALLET_PASS)
other_wallet_path = os.path.join(get_assets_dir_path(), f"{str(uuid.uuid4())}.json")
other_wallet_address = init_wallet(other_wallet_path, WALLET_PASS)
self.other_wallet = NodeWallet(path=other_wallet_path, address=other_wallet_address, password=WALLET_PASS)
self.other_wallet = create_wallet()
self.other_public_key = get_wallet_public_key(self.other_wallet.path, WALLET_PASS)

@allure.title("Test S3: put object with ACL")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import os

import allure
import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import os

import allure
import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import calendar
import logging
from datetime import UTC, datetime, timedelta
from datetime import datetime, timedelta
from typing import Optional

import allure
Expand Down
2 changes: 0 additions & 2 deletions pytest_tests/tests/system/test_sighup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
import signal
import socket
import time
from importlib.resources import files

import allure
import pytest
import yaml
from neofs_testlib.env.env import NeoFSEnv

Expand Down
2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ exclude = [
"node_modules",
"site-packages",
"venv",
"**/__init__.py"
]

# Same as Black.
Expand All @@ -38,7 +39,6 @@ target-version = "py312"
[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = ["E4", "E7", "E9", "F"]
ignore = ["F401"]

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
Expand Down
Loading