Replies: 1 comment
-
|
The problem was this line of code: Base.metadata.create_all(bind=engine). The mocking was working perfectly. The thing is that in the configuration, that creates all your models in the db. So, that should only be run manually . I modified to be a function for now and it worked perfectly in my pipeline. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
I'm getting the error: "Can't connect to MySQL server on 'localhost' in the pipeline but it shouldn't because I'm mocking the connection with magic mock. The tests work perfectly in my local machine but not in the pipeline.
The error: ImportError while loading conftest '/home/runner/work/gitworkflow2/gitworkflow2/backend/tests/conftest.py'. tests/conftest.py:3: in from main import app main.py:11: in Base.metadata.create_all(bind=engine)
E sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'localhost' ([Errno 111] Connection refused)")
My code
Main:
My pipeline
Operating System
macOS
Operating System Details
No response
FastAPI Version
0.104.1
Pydantic Version
2.4.2
Python Version
3.10.9
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions