Skip to content
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

Failed to run tests with fastapi templates on Linux and Mac #12

Closed
v-jiaodi opened this issue Oct 16, 2023 · 6 comments
Closed

Failed to run tests with fastapi templates on Linux and Mac #12

v-jiaodi opened this issue Oct 16, 2023 · 6 comments

Comments

@v-jiaodi
Copy link
Member

v-jiaodi commented Oct 16, 2023

Describe the issue:
When test Running tests with fastapi templates on Linux and Mac, run python3 -m pytest, get error as follow:
image

Repro Steps:

  1. Clone the repo to local.
  2. Create a Python virtual environment and activate it.
  3. Install requirements:
    python3 -m pip install -r requirements-dev.in
    playwright install --with-deps
  4. Run the tests: python3 -m pytest

Environment:

Expected behavior:
Running python3 -m pytest with flask templates can pass on Linux and Mac.

@pamelafox for notification.

@pamelafox
Copy link
Contributor

Can you copy and paste the full error message? (That starts with SSL error) You might also need to scroll up.

@pamelafox
Copy link
Contributor

Did you set up a Postgres database locally with the correct username/password? (The same as what would have been setup by the dev container)

@v-jiaodi
Copy link
Member Author

@pamelafox I set up a Postgres database locally with the correct username/password, the full error message as follow:
image

@pamelafox
Copy link
Contributor

I made various updates to the tests and also added instructions for running Postgres locally. Can you try it again?

If you're still getting an SSL error, I wonder why it's trying to use SSL. You could try explicitly setting a local environment variable of POSTGRES_SSL to "disable".

@pamelafox
Copy link
Contributor

Another thought - if you're still getting SSL issues, can you try changing line 19 in models to py to:

if os.environ.get("POSTGRES_HOST") == "localhost":
    sql_url = f"{sql_url}?sslmode=disable"

@v-jiaodi
Copy link
Member Author

Test again, the current issue no longer exists.

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

No branches or pull requests

2 participants