Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
AttackingOrDefending authored Feb 6, 2024
1 parent b0c5a2f commit fe51112
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/engine_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test_bot/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion test_bot/test_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion test_bot/test_options.py
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit fe51112

Please sign in to comment.