#3052·agentscope

[Bug]: Fix ImportError in S3 tests when moto is not installed

Author: ramashishmauryaCreated Sep 30, 2026Updated Sep 30, 2026
LabelsBugtriage/confirmed

Prerequisites

  • I have searched the existing issues and discussions, and this is not a duplicate.
  • This is a bug, not a usage question. (For questions, please use Discussions instead.)

Background / Description

Running the test suite via pytest crashes immediately (during the test collection phase) if the optional testing dependencies moto and boto3 are not installed.

Specifically, tests/blob_store_s3_test.py imports boto3 and moto.server unconditionally at the module level. This results in an ImportError which halts all test execution for anyone (or any CI environment) running pytest without these specific packages installed.

Error Messages

bash
=================================== ERRORS ====================================
________________ ERROR collecting tests/blob_store_s3_test.py _________________
ImportError while importing test module 'tests/blob_store_s3_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/blob_store_s3_test.py:36: in <module>
    from moto.server import ThreadedMotoServer
E   ModuleNotFoundError: No module named 'moto.server'
=========================== short test summary info ===========================
ERROR tests/blob_store_s3_test.py
!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!

Steps to Reproduce

  1. Create a fresh Python virtual environment.
  2. Install the basic test dependencies, but make sure moto and boto3 are not installed.
  3. Attempt to run the test suite: python -m pytest tests/
  4. The test suite will immediately crash during test collection with a ModuleNotFoundError for moto.server because the import is currently unconditional.

Environment

  • AgentScope version: 2.0.8
  • OS: Windows
  • Python version: 3.12

Source: agentscope-ai/agentscope