tests/. The tests cover the playback commands, queue behavior, event handlers, permissions checks, and the connection bootstrap that the modular architecture depends on.
Run the full suite
Run focused modules
Run one specific test
Testing the tests/ folder
The tests/ folder contains the core suite for the modular bot:
-
tests/conftest.py— shared fixtures and setup for all tests.songs,mock_track,mock_user, andguild_idcreate reusable test data.mock_bot_presencepatches bot presence changes.clean_active_playersclears shared runtime state such asACTIVE_PLAYERS,AUTO_DISCONNECT_TASKS, andVOTE_SKIPS.cogreturns theMusicCommandscog instance for command tests.
-
tests/test_connection.py— environment validation.test_environment_variables_loadconfirms required variables are present:BOT_TOKEN,LAVALINK_URI, andLAVALINK_PASSWORD.
-
tests/test_events.py— event handling and regression checks.test_regression_empty_channel_continues_playing_leakverifies an empty voice channel does not incorrectly keep playback alive.test_patch_v101_user_rejoin_cancels_countdownchecks that a returning user cancels an active auto-disconnect countdown.test_patch_v101_migration_helper_executes_clean_slatevalidates idle-session migration logic clears state, cancels disconnect tasks, deletes embeds, and moves the player.test_on_wavelink_track_end_partial_empty_auto_queue_fallbackensures partial autoplay re-populates the queue when both regular and auto queues are empty.
-
tests/test_permissions.py— user permission and vote-skip behavior.test_voteskip_logic_immediate_soloasserts a single listener can skip immediately.test_voteskip_logic_threshold_metverifies the 50% vote threshold triggers a skip only when enough listeners agree.test_dj_permission_logic_pass_scenarioscovers the server owner, administrator, and DJ role cases, and rejects non-privileged users.
-
tests/test_playback.py— playback command behavior, guards, and state persistence.test_skip_command_playingconfirms the skip command works when audio is active.test_pause_command_successandtest_resume_command_successverify pause/resume behavior.test_stop_command_successensures stop clears the queue, disconnects voice, and removes active player state.test_play_command_new_connectioncovers fresh join and track enqueue behavior.test_play_command_no_resultsconfirms the command handles empty search results.test_nowplaying_command_playingvalidates now-playing embed content.test_ping_commandverifies latency reporting.test_join_command_user_not_in_voiceguards join when the user is not in voice.test_volume_command_no_voice_client,test_volume_command_out_of_bounds_guards, andtest_volume_command_success_boundariescover volume error handling and valid bounds.test_loop_command_guard_when_not_playingandtest_loop_command_toggle_state_inversionverify loop command behavior.test_autoplay_command_guard_when_disconnectedandtest_autoplay_command_and_global_persistence_mappingverify autoplay mode persistence and disconnected guard behavior.test_update_player_message_ignores_api_errorsensures persistent message updates do not crash on edit failure.test_join_restores_persisted_autoplay_modevalidates join restores saved autoplay mode.test_previous_command_navigates_unified_historyandtest_previous_command_no_history_failscover previous-track navigation and no-history failures.test_remove_command_removes_from_regular_queueandtest_remove_command_removes_from_auto_queueverify removal logic for regular queue and autoplay queue entries.
-
tests/test_queue.py— queue UI and queue command tests.test_queue_view_pagination_logicchecks pagination, button states, and embed text for the queue view.test_clearqueue_commandverifies clearing both regular and autoplay queues.test_shuffle_command_successvalidates queue shuffling.test_queue_command_enforces_recommendation_limitensures the queue display caps recommendations to a manageable subset.test_remove_command_success,test_remove_command_invalid_position, andtest_remove_command_auto_queue_successcover removing tracks from both queues and invalid positions.
Watch for changes during development
Related Topics
How to Contribute
Report bugs, suggest features, and help improve the modular Discord music bot project.
Linting and Formatting
Maintain high code quality in the testbot project using Ruff.
Local Development
Install the Mintlify CLI to preview documentation locally, test changes in real time, and catch build errors.
Lavalink Setup
Deep-dive into running and tuning the Lavalink Docker node.