databio / bbconf

Configuration package for bedbase project
https://pypi.org/project/bbconf/
BSD 2-Clause "Simplified" License
1 stars 2 forks source link

tests may require external server #26

Closed nsheff closed 6 months ago

nsheff commented 8 months ago

please fix pytests. Right now I can't just run pytest because they are relying on something eternal, which is not documented.

The rules of testing should be:

  1. ideally, the default unit tests should rely on no external services or setup. A user should be able to type pytest and get a meaningful test.
  2. if an external service is really critical, for testing, then optional additional tests may require it, but how to set it up should be a one-line command and should be included in the README

This is the error I get:

>       conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
E       sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "127.0.0.1", port 5432 failed: Connection refused
E           Is the server running on that host and accepting TCP/IP connections?
E       
E       (Background on this error at: https://sqlalche.me/e/14/e3q8)

../../.local/lib/python3.8/site-packages/psycopg2/__init__.py:122: OperationalError
=========================== short test summary info ============================
FAILED tests/test_bbconf.py::TestAll::test_invalid_config - sqlalchemy.exc.Op...
FAILED tests/test_bbconf.py::TestAll::test_tables_creation - sqlalchemy.exc.O...
FAILED tests/test_bbconf.py::TestAll::test_data_insert - sqlalchemy.exc.Opera...
FAILED tests/test_bbconf.py::TestAll::test_nonunique_digest_insert_error - sq...
FAILED tests/test_bbconf.py::TestAll::test_reporting_relationships - sqlalche...
FAILED tests/test_bbconf.py::TestAll::test_cant_remove_record_if_in_reltable
FAILED tests/test_bbconf.py::TestAll::test_select - sqlalchemy.exc.Operationa...
FAILED tests/test_bbconf.py::TestAll::test_removal - sqlalchemy.exc.Operation...
FAILED tests/test_bbconf.py::TestAll::test_config_variables_are_set - sqlalch...
============================== 9 failed in 8.72s ===============================
khoroshevskyi commented 8 months ago

Tests won't work now, because we don't have geniml released. And it is critical for us

nsheff commented 8 months ago

I should still be able to run them locally, with geniml installed.