Skip to content

How to run tests? #180

@SKalt

Description

@SKalt

The question/request: instructions for running the tests from a cold start. Better yet, a script to set up a database server for running the tests.

Here's the story that led to me filing this issue.

To check my development environment, I wanted to run the unit tests. make test was a familiar way to do so. First, that failed since I didn't have my virtualenv activated. Then, the tests failed since I didn't have postgres running. That wasn't unexpected I fired up a server using docker run -p 5432:5432 -d postgres:12-alpine. That command failed since docker.io/library/postgres expects explicit authentication configuration. I set POSTGRES_HOST_AUTH_METHOD=trust, and found out the tests expect the postgres server to have a user with the same username as the current user running the tests.

I couldn't find docs on running the tests, so I copied the ./.circleci/config.yml and ran

docker run -d  \
  -e POSTGRES_HOST_AUTH_METHOD=trust \
  -e POSTGRES_USER=$USER \
  -e POSTGRES_DATABASE=$USER \
  -p 5432:5432 \
  postgres:13

Now tests/test_migra.py::test_singleschema is failing with psycopg2.errors.UndefinedObject: role "postgres" does not exist, and I'm still lost. Hence the issue.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions