Skip to content

Commit

Permalink
fix requirements for python 3.7, fix module refereneces in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Carlo van Driesten <[email protected]>
  • Loading branch information
jdsika committed Nov 2, 2023
1 parent 6e984b8 commit 8eb8b89
Show file tree
Hide file tree
Showing 38 changed files with 134 additions and 132 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ parse>=1.19.1
transitions>=0.9.0
tweepy>=4.14.0
pip>=23.3.1
python-dotenv==1.0.0
python-dotenv==0.21.1
2 changes: 1 addition & 1 deletion requirements_developers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parameterized>=0.9.0
Pygments>=2.16.1
graphviz>=0.20.1
click==8.1.7
black==23.10.1
black==23.3.0
flake8>=5.0.4
recommonmark==0.7.1
sphinx_rtd_theme==1.3.0
Expand Down
2 changes: 1 addition & 1 deletion service_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
import argparse
from src.Constants import BASE_DIR, CONFIG_DIR
from util.exit_program import exit_program, ExitCode
from src.util.exit_program import exit_program, ExitCode


def command_line_arguments():
Expand Down
24 changes: 12 additions & 12 deletions tests/integration/test_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
from unittest import TestCase
from unittest.mock import patch, MagicMock

from Constants import RewardsType, MUTEZ_PER_TEZ
from api.provider_factory import ProviderFactory
from calc.phased_payment_calculator import PhasedPaymentCalculator
from calc.calculate_phaseMapping import CalculatePhaseMapping
from calc.calculate_phaseMerge import CalculatePhaseMerge
from calc.calculate_phaseZeroBalance import CalculatePhaseZeroBalance
from calc.service_fee_calculator import ServiceFeeCalculator
from config.yaml_baking_conf_parser import BakingYamlConfParser
from exception.api_provider import ApiProviderException
from model.rules_model import RulesModel
from model.baking_conf import BakingConf
from NetworkConfiguration import default_network_config_map
from src.Constants import RewardsType, MUTEZ_PER_TEZ
from src.api.provider_factory import ProviderFactory
from src.calc.phased_payment_calculator import PhasedPaymentCalculator
from src.calc.calculate_phaseMapping import CalculatePhaseMapping
from src.calc.calculate_phaseMerge import CalculatePhaseMerge
from src.calc.calculate_phaseZeroBalance import CalculatePhaseZeroBalance
from src.calc.service_fee_calculator import ServiceFeeCalculator
from src.config.yaml_baking_conf_parser import BakingYamlConfParser
from src.exception.api_provider import ApiProviderException
from src.model.rules_model import RulesModel
from src.model.baking_conf import BakingConf
from src.NetworkConfiguration import default_network_config_map
from tests.utils import mock_request_get, make_config

PAYOUT_CYCLE = 557
Expand Down
14 changes: 7 additions & 7 deletions tests/integration/test_retry_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from distutils.dir_util import copy_tree
from unittest import TestCase
from unittest.mock import patch, MagicMock
from Constants import PaymentStatus, RewardsType, TEMP_TEST_DATA_DIR
from cli.client_manager import ClientManager
from pay.payment_consumer import PaymentConsumer
from pay.payment_producer_abc import PaymentProducerABC
from pay.retry_producer import RetryProducer
from util.csv_payment_file_parser import CsvPaymentFileParser
from util.dir_utils import get_payment_report_file_path
from src.Constants import PaymentStatus, RewardsType, TEMP_TEST_DATA_DIR
from src.cli.client_manager import ClientManager
from src.pay.payment_consumer import PaymentConsumer
from src.pay.payment_producer_abc import PaymentProducerABC
from src.pay.retry_producer import RetryProducer
from src.util.csv_payment_file_parser import CsvPaymentFileParser
from src.util.dir_utils import get_payment_report_file_path


TEST_REPORT_DIR = "tests/integration/test_reports"
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_rpc_reward_api.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import pytest
from http import HTTPStatus
from rpc.rpc_reward_api import RpcRewardApiImpl
from src.rpc.rpc_reward_api import RpcRewardApiImpl
from unittest.mock import patch, MagicMock
from Constants import (
from src.Constants import (
PUBLIC_NODE_URL,
DEFAULT_NETWORK_CONFIG_MAP,
MAX_SEQUENT_CALLS,
RewardsType,
)
from tests.utils import load_reward_model, store_reward_model, Constants
from exception.api_provider import ApiProviderException
from src.exception.api_provider import ApiProviderException
from requests.exceptions import RequestException

# Use this baker because he has < 40 delegates which can be fetched fast
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_tzkt_block_api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from unittest.mock import patch, MagicMock
from src.Constants import DEFAULT_NETWORK_CONFIG_MAP
from tzkt.tzkt_block_api import TzKTBlockApiImpl
from src.tzkt.tzkt_block_api import TzKTBlockApiImpl
from tests.utils import Constants

MAINNET_ADDRESS_DELEGATOR = Constants.MAINNET_ADDRESS_DELEGATOR
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_tzstats_reward_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from unittest.mock import patch, MagicMock
from src.Constants import DEFAULT_NETWORK_CONFIG_MAP, RewardsType
from tests.utils import load_reward_model, store_reward_model, Constants
from exception.api_provider import ApiProviderException
from src.exception.api_provider import ApiProviderException

MAINNET_ADDRESS_STAKENOW_BAKER = Constants.MAINNET_ADDRESS_STAKENOW_BAKER
CYCLE = 100
Expand Down
8 changes: 4 additions & 4 deletions tests/regression/test_attempt_single_batch.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from unittest.mock import patch, MagicMock
from pay.batch_payer import BatchPayer, TX_FEES, OpCounter
from model.reward_log import RewardLog
from cli.client_manager import ClientManager
from src.pay.batch_payer import BatchPayer, TX_FEES, OpCounter
from src.model.reward_log import RewardLog
from src.cli.client_manager import ClientManager
from http import HTTPStatus
from Constants import (
from src.Constants import (
CURRENT_TESTNET,
PUBLIC_NODE_URL,
PRIVATE_SIGNER_URL,
Expand Down
26 changes: 13 additions & 13 deletions tests/regression/test_disk_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
import queue
import logging
from unittest.mock import MagicMock, patch
from pay.payment_producer import PaymentProducer
from pay.payment_consumer import PaymentConsumer
from src.pay.payment_producer import PaymentProducer
from src.pay.payment_consumer import PaymentConsumer
from tests.utils import Args, make_config
from plugins import plugins
from Constants import RunMode, TZKT_PUBLIC_API_URL, PUBLIC_NODE_URL
from cli.client_manager import ClientManager
from NetworkConfiguration import init_network_config
from model.baking_dirs import BakingDirs
from model.baking_conf import BakingConf
from api.provider_factory import ProviderFactory
from config.yaml_baking_conf_parser import BakingYamlConfParser
from calc.service_fee_calculator import ServiceFeeCalculator
from util.process_life_cycle import ProcessLifeCycle
from util.disk_is_full import disk_is_full
from src.plugins import plugins
from src.Constants import RunMode, TZKT_PUBLIC_API_URL, PUBLIC_NODE_URL
from src.cli.client_manager import ClientManager
from src.NetworkConfiguration import init_network_config
from src.model.baking_dirs import BakingDirs
from src.model.baking_conf import BakingConf
from src.api.provider_factory import ProviderFactory
from src.config.yaml_baking_conf_parser import BakingYamlConfParser
from src.calc.service_fee_calculator import ServiceFeeCalculator
from src.util.process_life_cycle import ProcessLifeCycle
from src.util.disk_is_full import disk_is_full

logger = logging.getLogger("unittesting")
logger.setLevel(logging.DEBUG)
Expand Down
30 changes: 15 additions & 15 deletions tests/regression/test_gas_estimation_oven_kt1.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# FIXME redo mockups for this test
from unittest.mock import patch, MagicMock

from pay.batch_payer import BatchPayer
from cli.client_manager import ClientManager
from Constants import (
from src.pay.batch_payer import BatchPayer
from src.cli.client_manager import ClientManager
from src.Constants import (
PUBLIC_NODE_URL,
RewardsType,
PRIVATE_SIGNER_URL,
MUTEZ_PER_TEZ,
)
from api.provider_factory import ProviderFactory
from config.yaml_baking_conf_parser import BakingYamlConfParser
from model.baking_conf import BakingConf
from calc.service_fee_calculator import ServiceFeeCalculator
from src.api.provider_factory import ProviderFactory
from src.config.yaml_baking_conf_parser import BakingYamlConfParser
from src.model.baking_conf import BakingConf
from src.calc.service_fee_calculator import ServiceFeeCalculator
from tests.utils import make_config
from model.rules_model import RulesModel
from NetworkConfiguration import default_network_config_map
from plugins.plugins import PluginManager

from calc.phased_payment_calculator import PhasedPaymentCalculator
from calc.calculate_phaseMapping import CalculatePhaseMapping
from calc.calculate_phaseMerge import CalculatePhaseMerge
from calc.calculate_phaseZeroBalance import CalculatePhaseZeroBalance
from src.model.rules_model import RulesModel
from src.NetworkConfiguration import default_network_config_map
from src.plugins.plugins import PluginManager

from src.calc.phased_payment_calculator import PhasedPaymentCalculator
from src.calc.calculate_phaseMapping import CalculatePhaseMapping
from src.calc.calculate_phaseMerge import CalculatePhaseMerge
from src.calc.calculate_phaseZeroBalance import CalculatePhaseZeroBalance
from src.model.reward_log import TYPE_DELEGATOR

node_endpoint = PUBLIC_NODE_URL["MAINNET"]
Expand Down
4 changes: 2 additions & 2 deletions tests/regression/test_level_in_cycle.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from Constants import DEFAULT_NETWORK_CONFIG_MAP
from api.block_api import BlockApi
from src.Constants import DEFAULT_NETWORK_CONFIG_MAP
from src.api.block_api import BlockApi


class DummyApiImpl(BlockApi):
Expand Down
4 changes: 1 addition & 3 deletions tests/regression/test_requirements_installed.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import pytest
from src.main import requirements_installed, installed
from main import start_application
from src.main import requirements_installed, installed, start_application
from unittest.mock import patch, MagicMock
from datetime import date


@patch("main.requirements_installed", MagicMock(return_value=False))
Expand Down
8 changes: 4 additions & 4 deletions tests/regression/test_simulate_single_operation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from unittest.mock import patch, MagicMock
from pay.batch_payer import BatchPayer, TX_FEES, MUTEZ_PER_GAS_UNIT
from model.reward_log import RewardLog
from cli.client_manager import ClientManager
from src.pay.batch_payer import BatchPayer, TX_FEES, MUTEZ_PER_GAS_UNIT
from src.model.reward_log import RewardLog
from src.cli.client_manager import ClientManager
from http import HTTPStatus
from Constants import (
from src.Constants import (
CURRENT_TESTNET,
PUBLIC_NODE_URL,
PRIVATE_SIGNER_URL,
Expand Down
4 changes: 2 additions & 2 deletions tests/regression/test_tzkt_no_content_request.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest
from http import HTTPStatus
from unittest.mock import patch, MagicMock
from tzkt.tzkt_api import TzKTApi, TzKTApiError
from Constants import TZKT_PUBLIC_API_URL
from src.tzkt.tzkt_api import TzKTApi, TzKTApiError
from src.Constants import TZKT_PUBLIC_API_URL


class NoContentResponse:
Expand Down
4 changes: 2 additions & 2 deletions tests/regression/test_verbose_logging_helper.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import shutil
import logging
from unittest import TestCase

from src.log_config import FORMATTER
from src.verbose_logging_helper import VerboseLoggingHelper
import logging
import os


class TestVerboseLoggingHelper(TestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/smoke/test_launch_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import pytest
from datetime import datetime
from unittest.mock import MagicMock, patch
from Constants import CURRENT_TESTNET, TZKT_PUBLIC_API_URL, PUBLIC_NODE_URL
from main import start_application
from src.Constants import CURRENT_TESTNET, TZKT_PUBLIC_API_URL, PUBLIC_NODE_URL
from src.main import start_application
from tests.utils import Args, make_config


Expand Down
4 changes: 2 additions & 2 deletions tests/smoke/test_rpc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from datetime import datetime
from unittest.mock import patch, MagicMock
from tests.utils import Args, make_config
from Constants import CURRENT_TESTNET, PUBLIC_NODE_URL
from main import start_application
from src.Constants import CURRENT_TESTNET, PUBLIC_NODE_URL
from src.main import start_application


@pytest.fixture
Expand Down
4 changes: 2 additions & 2 deletions tests/smoke/test_tzkt_api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pytest
from unittest.mock import patch, MagicMock
from datetime import datetime
from main import start_application
from src.main import start_application
from tests.utils import Args, make_config
from Constants import TZKT_PUBLIC_API_URL, PUBLIC_NODE_URL
from src.Constants import TZKT_PUBLIC_API_URL, PUBLIC_NODE_URL


@pytest.fixture
Expand Down
16 changes: 10 additions & 6 deletions tests/unit/test_BakingYamlConfParser.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from unittest import TestCase
from unittest.mock import patch, MagicMock
from Constants import PUBLIC_NODE_URL, PRIVATE_SIGNER_URL
from cli.client_manager import ClientManager
from config.addr_type import AddrType
from config.yaml_baking_conf_parser import BakingYamlConfParser
from Constants import RewardsType, DEFAULT_NETWORK_CONFIG_MAP
from rpc.rpc_block_api import RpcBlockApiImpl
from src.Constants import (
PUBLIC_NODE_URL,
PRIVATE_SIGNER_URL,
RewardsType,
DEFAULT_NETWORK_CONFIG_MAP,
)
from src.cli.client_manager import ClientManager
from src.config.addr_type import AddrType
from src.config.yaml_baking_conf_parser import BakingYamlConfParser
from src.rpc.rpc_block_api import RpcBlockApiImpl

node_endpoint = PUBLIC_NODE_URL["MAINNET"]
network = DEFAULT_NETWORK_CONFIG_MAP["MAINNET"]
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_TransitionsFsmBuilder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest import TestCase

from fsm.TransitionsFsmBuilder import TransitionsFsmBuilder
from src.fsm.TransitionsFsmBuilder import TransitionsFsmBuilder


class TestFsmBuilder(TestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_address_validator.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from util.address_validator import (
from src.util.address_validator import (
AddressValidator,
IncorrectAddressError,
IncorrectLengthError,
)
import pytest

from exception.configuration import ConfigurationException
from src.exception.configuration import ConfigurationException


@pytest.mark.parametrize(
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_args_validator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from util.parser import (
from src.util.parser import (
build_parser,
add_argument_provider,
)
from util.args_validator import ArgsValidator, validate
from src.util.args_validator import ArgsValidator, validate
import argparse
import pytest
import logging
import os
from Constants import PUBLIC_NODE_URL
from src.Constants import PUBLIC_NODE_URL


LOGGER = logging.getLogger(__name__)
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_calculatePhase0.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from unittest import TestCase
from calc.calculate_phase0 import CalculatePhase0
from model.reward_log import TYPE_OWNERS_PARENT
from api.provider_factory import ProviderFactory
from Constants import DEFAULT_NETWORK_CONFIG_MAP, RewardsType
from src.calc.calculate_phase0 import CalculatePhase0
from src.model.reward_log import TYPE_OWNERS_PARENT
from src.api.provider_factory import ProviderFactory
from src.Constants import DEFAULT_NETWORK_CONFIG_MAP, RewardsType

BAKING_ADDRESS = "tz1fikAGfa1MTxX2oJ7UCtvDpVKeH4KTp1UY"
CYCLE = 420
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/test_calculatePhase1.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from unittest import TestCase

from calc.calculate_phase1 import CalculatePhase1
from model.reward_log import RewardLog
from src.calc.calculate_phase1 import CalculatePhase1
from src.model.reward_log import RewardLog


class TestCalculatePhase1(TestCase):
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/test_calculatePhase2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from unittest import TestCase

from calc.calculate_phase2 import CalculatePhase2
from model.reward_log import RewardLog
from src.calc.calculate_phase2 import CalculatePhase2
from src.model.reward_log import RewardLog


class TestCalculatePhase2(TestCase):
Expand Down
Loading

0 comments on commit 8eb8b89

Please sign in to comment.