Skip to content

feat(endcycle-sniper): add unit test suite and fix datetime deprecation#9

Open
b5119 wants to merge 1 commit intoGabagool2-2:mainfrom
b5119:feat/add-unit-tests-and-fix-datetime-deprecation
Open

feat(endcycle-sniper): add unit test suite and fix datetime deprecation#9
b5119 wants to merge 1 commit intoGabagool2-2:mainfrom
b5119:feat/add-unit-tests-and-fix-datetime-deprecation

Conversation

@b5119
Copy link

@b5119 b5119 commented Mar 14, 2026

What

  • Adds a missing tests/ directory with 26 unit tests for BotStats
    and ArbitrageBot in the endcycle-sniper-bot module
  • Fixes datetime.utcnow() which is deprecated in Python 3.12+
  • Fixes the resulting offset-naive/aware TypeError in _log_stats()
    and get_stats()

Why

pyproject.toml already declared pytest in dev deps and
testpaths = ["tests"] but the folder didn't exist.
Running on Python 3.12 also surfaces 29 deprecation warnings
from datetime.utcnow() — all now resolved.

Tests

26 passed, 0 warnings ✅
No credentials or network access required to run.

- Add tests/ with 26 passing unit tests for BotStats and ArbitrageBot
- Tests use sys.modules mocking — no credentials or network required
- Fix datetime.utcnow() deprecated in Python 3.12+ across bot.py
- Fix offset-naive/aware inconsistency introduced by the deprecation fix
- pyproject.toml already declared pytest deps + testpaths but had no tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant