Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = "MIT"
name = "pytest-databases"
readme = "README.md"
requires-python = ">=3.9"
version = "0.12.1"
version = "0.12.2"
#
authors = [{ name = "Cody Fincher", email = "[email protected]" }]
keywords = [
Expand Down Expand Up @@ -117,7 +117,7 @@ dev = [
allow_dirty = true
commit = true
commit_args = "--no-verify"
current_version = "0.12.1"
current_version = "0.12.2"
ignore_missing_files = false
ignore_missing_version = false
message = "chore(release): bump to v{new_version}"
Expand Down
36 changes: 30 additions & 6 deletions src/pytest_databases/docker/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,46 @@ def check(_service: ServiceContainer) -> bool:


@pytest.fixture(autouse=False, scope="session")
def oracle_23ai_service(docker_service: DockerService) -> Generator[OracleService, None, None]:
def oracle_23ai_image() -> str:
return "gvenzl/oracle-free:23-slim-faststart"


@pytest.fixture(autouse=False, scope="session")
def oracle_23ai_service_name() -> str:
return "FREEPDB1"


@pytest.fixture(autouse=False, scope="session")
def oracle_18c_image() -> str:
return "gvenzl/oracle-xe:18-slim-faststart"


@pytest.fixture(autouse=False, scope="session")
def oracle_18c_service_name() -> str:
return "xepdb1"


@pytest.fixture(autouse=False, scope="session")
def oracle_23ai_service(
docker_service: DockerService, oracle_23ai_image: str, oracle_23ai_service_name: str
) -> Generator[OracleService, None, None]:
with _provide_oracle_service(
image="gvenzl/oracle-free:23-slim-faststart",
image=oracle_23ai_image,
name="oracle23ai",
service_name="FREEPDB1",
service_name=oracle_23ai_service_name,
docker_service=docker_service,
) as service:
yield service


@pytest.fixture(autouse=False, scope="session")
def oracle_18c_service(docker_service: DockerService) -> Generator[OracleService, None, None]:
def oracle_18c_service(
docker_service: DockerService, oracle_18c_image: str, oracle_18c_service_name: str
) -> Generator[OracleService, None, None]:
with _provide_oracle_service(
image="gvenzl/oci-oracle-xe:18-slim-faststart",
image=oracle_18c_image,
name="oracle18c",
service_name="xepdb1",
service_name=oracle_18c_service_name,
docker_service=docker_service,
) as service:
yield service
Expand Down
19 changes: 9 additions & 10 deletions tests/test_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

import pytest

pytestmark = pytest.mark.skip()


@pytest.mark.parametrize(
"service_fixture",
[
"oracle_18c_service",
"oracle_23ai_service",
"oracle_23ai_service",
],
)
def test_service_fixture(pytester: pytest.Pytester, service_fixture: str) -> None:
Expand All @@ -20,21 +17,23 @@ def test_service_fixture(pytester: pytest.Pytester, service_fixture: str) -> Non

def test({service_fixture}):
conn = oracledb.connect(
user=service_fixture.user,
password=service_fixture.password,
dsn=f"{{{service_fixture}.host}}:{{{service_fixture}.port!s}}/{{{service_fixture}.service_name}}",
user={service_fixture}.user,
password={service_fixture}.password,
service_name={service_fixture}.service_name,
host={service_fixture}.host,
port={service_fixture}.port,
)
with conn.cursor() as cur:
cur.execute("SELECT 'Hello World!' FROM dual")
res = cur.fetchall()[0][0]
assert "Hello World!" in res
cur.execute("SELECT 1 FROM dual")
res = cur.fetchone()[0]
assert res == 1
""")

result = pytester.runpytest()
result.assert_outcomes(passed=1)


@pytest.mark.parametrize("connection_fixture", ["oracle_18c_connection"])
@pytest.mark.parametrize("connection_fixture", ["oracle_18c_connection", "oracle_23ai_connection"])
def test_connection_fixture(pytester: pytest.Pytester, connection_fixture: str) -> None:
pytester.makepyfile(f"""
import oracledb
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.