diff --git a/fastlane_bot/tests/test_048_RespectFlashloanTokensClickParam.py b/fastlane_bot/tests/test_048_RespectFlashloanTokensClickParam.py index ddcec38c9..4f71813ea 100644 --- a/fastlane_bot/tests/test_048_RespectFlashloanTokensClickParam.py +++ b/fastlane_bot/tests/test_048_RespectFlashloanTokensClickParam.py @@ -7,15 +7,13 @@ # ------------------------------------------------------------ - """ -This module contains the tests which ensure that the flashloan tokens click parameters are respected. +This module contains the tests the `multi_pairwise_all` arb-mode with the `flashloan_tokens` parameter. """ from fastlane_bot import Bot from fastlane_bot.tools.cpc import ConstantProductCurve as CPC from fastlane_bot.events.exchanges import UniswapV2, UniswapV3, CarbonV1, BancorV3 -import subprocess, os, sys -import pytest +import subprocess, os print("{0.__name__} v{0.__VERSION__} ({0.__DATE__})".format(CPC)) print("{0.__name__} v{0.__VERSION__} ({0.__DATE__})".format(Bot)) print("{0.__name__} v{0.__VERSION__} ({0.__DATE__})".format(UniswapV2)) @@ -28,8 +26,6 @@ require("3.0", __VERSION__) - - def find_main_py(): # Start at the directory of the current script cwd = os.path.abspath(os.path.join(os.getcwd())) @@ -50,37 +46,24 @@ def find_main_py(): cwd = new_cwd -def run_command(arb_mode): +# ------------------------------------------------------------ +# Test 048 +# File test_048_RespectFlashloanTokensClickParam.py +# Segment Test flashloan_tokens is Respected +# ------------------------------------------------------------ +def test_test_multi_pairwise_all_with_flashloan_tokens(): +# ------------------------------------------------------------ - # Find the correct path to main.py - main_script_path = find_main_py() - print(f"Found main.py in {main_script_path}") - main_script_path = os.path.normpath(main_script_path + "/main.py") - - # Run the command cmd = [ "python", - main_script_path, - f"--arb_mode={arb_mode}", + find_main_py() + "/main.py", + f"--arb_mode=multi_pairwise_all", "--default_min_profit_gas_token=0.001", - "--limit_bancor3_flashloan_tokens=False", "--use_cached_events=False", - "--timeout=1", - "--loglevel=DEBUG", + "--timeout=120", "--flashloan_tokens='0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C,0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE,0xAa6E8127831c9DE45ae56bB1b0d4D4Da6e5665BD'", "--blockchain=ethereum" ] result = subprocess.run(cmd, text=True, capture_output=True, check=True) - print(result.stderr) - - -# ------------------------------------------------------------ -# Test 048 -# File test_048_RespectFlashloanTokensClickParam.py -# Segment Test flashloan_tokens is Respected -# ------------------------------------------------------------ -def test_test_flashloan_tokens_is_respected(): -# ------------------------------------------------------------ - - run_command("multi_pairwise_all") \ No newline at end of file + assert result.returncode == 0 diff --git a/fastlane_bot/tests/test_903_FlashloanTokens.py b/fastlane_bot/tests/test_903_FlashloanTokens.py index a23861378..b1dce1345 100644 --- a/fastlane_bot/tests/test_903_FlashloanTokens.py +++ b/fastlane_bot/tests/test_903_FlashloanTokens.py @@ -7,15 +7,13 @@ # ------------------------------------------------------------ - """ -This module contains the tests which ensure the the flashloan_tokens parameter is respected when using the b3_two_hop and bancor_v3 arb modes. +This module contains the tests the `b3_two_hop` arb-mode with the `flashloan_tokens` parameter. """ from fastlane_bot import Bot from fastlane_bot.tools.cpc import ConstantProductCurve as CPC from fastlane_bot.events.exchanges import UniswapV2, UniswapV3, CarbonV1, BancorV3 -import subprocess, os, sys -import pytest +import subprocess, os print("{0.__name__} v{0.__VERSION__} ({0.__DATE__})".format(CPC)) print("{0.__name__} v{0.__VERSION__} ({0.__DATE__})".format(Bot)) print("{0.__name__} v{0.__VERSION__} ({0.__DATE__})".format(UniswapV2)) @@ -28,15 +26,10 @@ require("3.0", __VERSION__) - - def find_main_py(): # Start at the directory of the current script cwd = os.path.abspath(os.path.join(os.getcwd())) - with open("log.txt", "w") as f: - f.write(f"Searching for main.py in {cwd}") - print(f"Searching for main.py in {cwd}") while True: # Check if main.py exists in the current directory @@ -53,18 +46,18 @@ def find_main_py(): cwd = new_cwd -def run_command(mode): +# ------------------------------------------------------------ +# Test 903 +# File test_903_FlashloanTokens.py +# Segment Test b3_two_hop with flashloan tokens +# ------------------------------------------------------------ +def test_test_b3_two_hop_with_flashloan_tokens(): +# ------------------------------------------------------------ - # Find the correct path to main.py - main_script_path = find_main_py() - print(f"Found main.py in {main_script_path}") - main_script_path = main_script_path + "/main.py" - - # Run the command cmd = [ "python", - main_script_path, - f"--arb_mode={mode}", + find_main_py() + "/main.py", + f"--arb_mode=b3_two_hop", "--default_min_profit_gas_token=60", "--limit_bancor3_flashloan_tokens=True", "--alchemy_max_block_fetch=5", @@ -74,16 +67,4 @@ def run_command(mode): ] result = subprocess.run(cmd, text=True, capture_output=True, check=True) - print(result.stderr) - - -# ------------------------------------------------------------ -# Test 903 -# File test_903_FlashloanTokens.py -# Segment Test Flashloan Tokens b3_two_hop -# ------------------------------------------------------------ -def test_test_flashloan_tokens_b3_two_hop(): -# ------------------------------------------------------------ - - # + is_executing=true - run_command("b3_two_hop") \ No newline at end of file + assert result.returncode == 0 diff --git a/fastlane_bot/tests/test_906_TargetTokens.py b/fastlane_bot/tests/test_906_TargetTokens.py index 396363a77..66fdbf402 100644 --- a/fastlane_bot/tests/test_906_TargetTokens.py +++ b/fastlane_bot/tests/test_906_TargetTokens.py @@ -7,9 +7,8 @@ # ------------------------------------------------------------ - """ -This module contains the tests which ensure the target_tokens parameter is respected. +This module contains the tests the `b3_two_hop` arb-mode with the `target_tokens` parameter. """ from fastlane_bot import Bot, ConfigNetwork from fastlane_bot.tools.cpc import ConstantProductCurve as CPC @@ -31,9 +30,6 @@ def find_main_py(): # Start at the directory of the current script cwd = os.path.abspath(os.path.join(os.getcwd())) - with open("log.txt", "w") as f: - f.write(f"Searching for main.py in {cwd}") - print(f"Searching for main.py in {cwd}") while True: # Check if main.py exists in the current directory @@ -50,19 +46,18 @@ def find_main_py(): cwd = new_cwd -def run_command(mode): +# ------------------------------------------------------------ +# Test 906 +# File test_906_TargetTokens.py +# Segment Test b3_two_hop with target tokens +# ------------------------------------------------------------ +def test_test_b3_two_hop_with_target_tokens(): +# ------------------------------------------------------------ - # Find the correct path to main.py - main_script_path = find_main_py() - print(f"Found main.py in {main_script_path}") - main_script_path = main_script_path + "/main.py" - - # Run the command cmd = [ "python", - main_script_path, - f"--arb_mode={mode}", - # "--use_cached_events=True", + find_main_py() + "/main.py", + f"--arb_mode=b3_two_hop", "--alchemy_max_block_fetch=5", "--logging_path=fastlane_bot/data/", "--timeout=120", @@ -71,15 +66,4 @@ def run_command(mode): ] result = subprocess.run(cmd, text=True, capture_output=True, check=True) - print(result.stderr) - - -# ------------------------------------------------------------ -# Test 906 -# File test_906_TargetTokens.py -# Segment Test Flashloan Tokens b3_two_hop -# ------------------------------------------------------------ -def test_test_flashloan_tokens_b3_two_hop(): -# ------------------------------------------------------------ - - run_command("b3_two_hop") \ No newline at end of file + assert result.returncode == 0