Skip to content
Charles Horn edited this page Aug 19, 2019 · 4 revisions

Infogami tests

Existing tests are located in the following locations:

Needs further investigation:

Pytest

We want to run tests using pytest, so there will be some (minor) work updating the existing tests from the original test frameworks. All tests should run on Travis CI via pytest: https://travis-ci.org/internetarchive/infogami/

Running tests locally

The current Open Library Docker development environment can be used by developers to run tests locally in a representative environment using the oldev container, from the root directory of your infogami repo:

Infogami unit tests:

docker run --rm -tv $PWD:/openlibrary/infogami -w /openlibrary/infogami oldev pytest

OR for all of the tests:

docker run --rm -tv $PWD:/openlibrary/vendor/infogami -w /openlibrary/vendor/infogami oldev pytest

This requires the Open Library oldev image to have been built following the instructions. This method is targeted toward current Open Library developers and guarantees a compatible environment to support our Open Library production deployment. We are not targeting independent Infogami instances with our current efforts.

DB tests

Create db to run tests in the OL dev environment:

su postgres -c "psql -c 'create database infobase_test;' -U postgres"
export USER=postgres

There seems to be a problem locally with the postgres user expecting to have a blank pw.

pytest tests fails with E OperationalError: FATAL: Peer authentication failed for user "postgres"