Skip to content

Commit 1bb18e9

Browse files
authored
fix(oracle): additional oracle updates (#71)
1 parent 0a2a5ed commit 1bb18e9

File tree

4 files changed

+42
-19
lines changed

4 files changed

+42
-19
lines changed

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ license = "MIT"
1212
name = "pytest-databases"
1313
readme = "README.md"
1414
requires-python = ">=3.9"
15-
version = "0.12.1"
15+
version = "0.12.2"
1616
#
1717
authors = [{ name = "Cody Fincher", email = "[email protected]" }]
1818
keywords = [
@@ -117,7 +117,7 @@ dev = [
117117
allow_dirty = true
118118
commit = true
119119
commit_args = "--no-verify"
120-
current_version = "0.12.1"
120+
current_version = "0.12.2"
121121
ignore_missing_files = false
122122
ignore_missing_version = false
123123
message = "chore(release): bump to v{new_version}"

src/pytest_databases/docker/oracle.py

+30-6
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,46 @@ def check(_service: ServiceContainer) -> bool:
9595

9696

9797
@pytest.fixture(autouse=False, scope="session")
98-
def oracle_23ai_service(docker_service: DockerService) -> Generator[OracleService, None, None]:
98+
def oracle_23ai_image() -> str:
99+
return "gvenzl/oracle-free:23-slim-faststart"
100+
101+
102+
@pytest.fixture(autouse=False, scope="session")
103+
def oracle_23ai_service_name() -> str:
104+
return "FREEPDB1"
105+
106+
107+
@pytest.fixture(autouse=False, scope="session")
108+
def oracle_18c_image() -> str:
109+
return "gvenzl/oracle-xe:18-slim-faststart"
110+
111+
112+
@pytest.fixture(autouse=False, scope="session")
113+
def oracle_18c_service_name() -> str:
114+
return "xepdb1"
115+
116+
117+
@pytest.fixture(autouse=False, scope="session")
118+
def oracle_23ai_service(
119+
docker_service: DockerService, oracle_23ai_image: str, oracle_23ai_service_name: str
120+
) -> Generator[OracleService, None, None]:
99121
with _provide_oracle_service(
100-
image="gvenzl/oracle-free:23-slim-faststart",
122+
image=oracle_23ai_image,
101123
name="oracle23ai",
102-
service_name="FREEPDB1",
124+
service_name=oracle_23ai_service_name,
103125
docker_service=docker_service,
104126
) as service:
105127
yield service
106128

107129

108130
@pytest.fixture(autouse=False, scope="session")
109-
def oracle_18c_service(docker_service: DockerService) -> Generator[OracleService, None, None]:
131+
def oracle_18c_service(
132+
docker_service: DockerService, oracle_18c_image: str, oracle_18c_service_name: str
133+
) -> Generator[OracleService, None, None]:
110134
with _provide_oracle_service(
111-
image="gvenzl/oci-oracle-xe:18-slim-faststart",
135+
image=oracle_18c_image,
112136
name="oracle18c",
113-
service_name="xepdb1",
137+
service_name=oracle_18c_service_name,
114138
docker_service=docker_service,
115139
) as service:
116140
yield service

tests/test_oracle.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22

33
import pytest
44

5-
pytestmark = pytest.mark.skip()
6-
75

86
@pytest.mark.parametrize(
97
"service_fixture",
108
[
119
"oracle_18c_service",
1210
"oracle_23ai_service",
13-
"oracle_23ai_service",
1411
],
1512
)
1613
def test_service_fixture(pytester: pytest.Pytester, service_fixture: str) -> None:
@@ -20,21 +17,23 @@ def test_service_fixture(pytester: pytest.Pytester, service_fixture: str) -> Non
2017
2118
def test({service_fixture}):
2219
conn = oracledb.connect(
23-
user=service_fixture.user,
24-
password=service_fixture.password,
25-
dsn=f"{{{service_fixture}.host}}:{{{service_fixture}.port!s}}/{{{service_fixture}.service_name}}",
20+
user={service_fixture}.user,
21+
password={service_fixture}.password,
22+
service_name={service_fixture}.service_name,
23+
host={service_fixture}.host,
24+
port={service_fixture}.port,
2625
)
2726
with conn.cursor() as cur:
28-
cur.execute("SELECT 'Hello World!' FROM dual")
29-
res = cur.fetchall()[0][0]
30-
assert "Hello World!" in res
27+
cur.execute("SELECT 1 FROM dual")
28+
res = cur.fetchone()[0]
29+
assert res == 1
3130
""")
3231

3332
result = pytester.runpytest()
3433
result.assert_outcomes(passed=1)
3534

3635

37-
@pytest.mark.parametrize("connection_fixture", ["oracle_18c_connection"])
36+
@pytest.mark.parametrize("connection_fixture", ["oracle_18c_connection", "oracle_23ai_connection"])
3837
def test_connection_fixture(pytester: pytest.Pytester, connection_fixture: str) -> None:
3938
pytester.makepyfile(f"""
4039
import oracledb

uv.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)