aboutsummaryrefslogtreecommitdiff
path: root/tests/integration/conftest.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-02-21 09:07:31 +0300
committerFrederick Muriuki Muriithi2022-02-21 09:18:39 +0300
commitf914dc21577253f293b50b890ea0ac4bd2fd5d1b (patch)
treee51406a86ac63ff59724baa9dc7b6cdf72976387 /tests/integration/conftest.py
parent058f6592d8815a64544f6721a9984b89ea92522a (diff)
downloadgenenetwork3-f914dc21577253f293b50b890ea0ac4bd2fd5d1b.tar.gz
Test partial corrs API with mix of existing and non-existing control traits
Test that the partial correlations endpoint handles a mix of existing and non-existing control traits gracefully and issues a warning to the user. Summary of changes: * gn3/computations/partial_correlations.py: Issue a warning for all non-existing control traits * gn3/db/partial_correlations.py: update queries - use `INNER JOIN` for tables instead of comma-separated list of tables * tests/integration/conftest.py: Add `db_conn` fixture to provide a database connection to the tests. This will probably be changed in the future to connect to a temporary database for tests. * tests/integration/test_partial_correlations.py: Add test to check for correct behaviour with a mix of existing and non-existing control traits
Diffstat (limited to 'tests/integration/conftest.py')
-rw-r--r--tests/integration/conftest.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py
index be58d80..e1d1c37 100644
--- a/tests/integration/conftest.py
+++ b/tests/integration/conftest.py
@@ -1,12 +1,22 @@
+"""Module that holds fixtures for integration tests"""
import pytest
from gn3.app import create_app
+from gn3.db_utils import database_connector
@pytest.fixture(scope="session")
def client():
+ """Create a test client fixture for tests"""
# Do some setup
app = create_app()
app.config.update({"TESTING": True})
app.testing = True
yield app.test_client()
# Do some teardown/cleanup
+
+
+@pytest.fixture
+def db_conn():
+ """Create a db connection fixture for tests"""
+ ## Update this to use temp db once that is in place
+ return database_connector()[0]