Skip to content

Commit

Permalink
cx_Oracle -> oracledb
Browse files Browse the repository at this point in the history
  • Loading branch information
sillitoe committed Jan 24, 2024
1 parent 235ebef commit a7717e1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions cath_alphaflow/db_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
import cx_Oracle
import oracledb as Oracle

from cath_alphaflow.settings import get_default_settings
from cath_alphaflow.predicted_domain_provider import OraclePredictedCathDomainProvider
Expand All @@ -15,7 +15,7 @@
DEFAULT_PASSWORD = config.ORACLE_DB_PASSWORD


class OraDB(OraclePredictedCathDomainProvider, cx_Oracle.Connection):
class OraDB(OraclePredictedCathDomainProvider, Oracle.Connection):
def __init__(
self,
host=DEFAULT_HOST,
Expand All @@ -24,8 +24,8 @@ def __init__(
user=DEFAULT_USER,
password=DEFAULT_PASSWORD,
):
self._dsn = cx_Oracle.makedsn(host, port, sid=sid)
self._conn = cx_Oracle.connect(user=user, password=password, dsn=self._dsn)
self._dsn = Oracle.makedsn(host, port, sid=sid)
self._conn = Oracle.connect(user=user, password=password, dsn=self._dsn)

@property
def conn(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_long_description():
install_requires=[
"click",
"google-cloud-storage",
"cx_oracle",
"oracledb",
"prettyconf",
"biopython",
"pdb-tools",
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from cath_alphaflow import settings
import logging
import pytest
import cx_Oracle
import oracledb as Oracle

from click.testing import CliRunner

Expand Down Expand Up @@ -97,7 +97,7 @@ def mock_connection(monkeypatch):
def mock_connect(*args, **kwargs):
return MockConnect()

monkeypatch.setattr(cx_Oracle, "connect", mock_connect)
monkeypatch.setattr(Oracle, "connect", mock_connect)


@pytest.fixture
Expand Down
6 changes: 2 additions & 4 deletions tests/test_db_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from unittest import mock
import logging

import cx_Oracle
import oracledb

from cath_alphaflow.db_utils import OraDB
from cath_alphaflow.settings import get_default_settings
Expand All @@ -17,9 +17,8 @@ def test_mock_query(create_mock_query):
assert rows == expected_rows


@mock.patch.object(cx_Oracle, "connect")
@mock.patch.object(oracledb, "connect")
def test_mock_connection(mock_connect, mock_settings):

settings = get_default_settings()

OraDB()
Expand All @@ -37,7 +36,6 @@ def test_mock_connection(mock_connect, mock_settings):


def test_yieldall(create_mock_query):

mock_rows = [
{"cath_code": "1", "description": "Mainly Alpha"},
{"cath_code": "2", "description": "Mainly Beta"},
Expand Down

0 comments on commit a7717e1

Please sign in to comment.