From fe51112488d41fd11c6ef921da68a83dbcb6c501 Mon Sep 17 00:00:00 2001 From: Ioannis Pantidis <40605232+AttackingOrDefending@users.noreply.github.com> Date: Tue, 6 Feb 2024 20:02:21 +0200 Subject: [PATCH] Add files via upload --- lib/engine_wrapper.py | 2 +- test_bot/conftest.py | 2 +- test_bot/test_bot.py | 2 +- test_bot/test_options.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/engine_wrapper.py b/lib/engine_wrapper.py index ecd0124d0..0de414c37 100644 --- a/lib/engine_wrapper.py +++ b/lib/engine_wrapper.py @@ -598,7 +598,7 @@ def getHomemadeEngine(name: str) -> type[MinimalEngine]: from lib import strategies from test_bot import strategies as test_strategies engine: type[MinimalEngine] - if test_options._called_from_test: + if test_options._called_from_test["in_test"]: engine = getattr(test_strategies, name) else: engine = getattr(strategies, name) diff --git a/test_bot/conftest.py b/test_bot/conftest.py index ab5ba4c11..da40ac4fa 100644 --- a/test_bot/conftest.py +++ b/test_bot/conftest.py @@ -7,7 +7,7 @@ def pytest_configure(config: Any) -> None: """Set pytest flag, so we know that lichess-bot is being run under pytest.""" from test_bot import test_options - test_options._called_from_test = True + test_options._called_from_test["in_test"] = True def pytest_sessionfinish(session: Any, exitstatus: Any) -> None: diff --git a/test_bot/test_bot.py b/test_bot/test_bot.py index e78f106c1..d8cae2bf0 100644 --- a/test_bot/test_bot.py +++ b/test_bot/test_bot.py @@ -18,7 +18,7 @@ import test_bot.lichess from test_bot import test_options from typing import Any -if not test_options._called_from_test: +if not test_options._called_from_test["in_test"]: sys.exit(f"The script {os.path.basename(__file__)} should only be run by pytest.") lichess_bot = importlib.import_module("lichess-bot") diff --git a/test_bot/test_options.py b/test_bot/test_options.py index d319d3983..4f8f3ae3b 100644 --- a/test_bot/test_options.py +++ b/test_bot/test_options.py @@ -1,3 +1,3 @@ """Add a pytest flag. It is set when lichess-bot is being run under pytest.""" -_called_from_test = False +_called_from_test = {"in_test": False}