Skip to content

Fix pytest error #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix pytest error #72

wants to merge 1 commit into from

Conversation

yu-heejin
Copy link

@yu-heejin yu-heejin commented Aug 17, 2025

I resolved an issue that occurred while running the project after cloning it with reference to the Development guide.

1. pytest can't found src/mysql_mcp_server/server.py

  • To resolve this issue, I added the pythonpath to pytest.ini.
======================================================================================================= ERRORS =======================================================================================================
_______________________________________________________________________________________ ERROR collecting tests/test_server.py ________________________________________________________________________________________
ImportError while importing test module '/Users/hee/Desktop/mysql_mcp_server/tests/test_server.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/homebrew/Cellar/[email protected]/3.10.13_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_server.py:2: in <module>
    from mysql_mcp_server.server import app, list_tools, list_resources, read_resource, call_tool
E   ModuleNotFoundError: No module named 'mysql_mcp_server'
============================================================================================== short test summary info ===============================================================================================
ERROR tests/test_server.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================================== 1 error in 0.12s ==================================================================================================

2. mcp and mysql-connector-python not installed

  • To resolve this issue, I added the library to requirements-dev.txt.
ImportError while loading conftest '/Users/hee/Desktop/mysql_mcp_server/tests/conftest.py'.
tests/conftest.py:4: in <module>
    import mysql.connector
E   ModuleNotFoundError: No module named 'mysql'
======================================================================================================= ERRORS =======================================================================================================
_______________________________________________________________________________________ ERROR collecting tests/test_server.py ________________________________________________________________________________________
ImportError while importing test module '/Users/hee/Desktop/mysql_mcp_server/tests/test_server.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/homebrew/Cellar/[email protected]/3.10.13_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_server.py:2: in <module>
    from mysql_mcp_server.server import app, list_tools, list_resources, read_resource, call_tool
src/mysql_mcp_server/__init__.py:1: in <module>
    from . import server
src/mysql_mcp_server/server.py:6: in <module>
    from mcp.server import Server
E   ModuleNotFoundError: No module named 'mcp'
============================================================================================== short test summary info ===============================================================================================
ERROR tests/test_server.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================================== 1 error in 0.12s ==================================================================================================

1. pytest not found src/mysql_mcp_server
2. mcp and mysql-connector-python not installed
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