Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
goodwanghan authored Nov 24, 2023
1 parent ad14b10 commit 25d1ba5
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion fugue/test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# flake8: noqa
from .pandas_backend import NativeTestBackend, PandasTestBackend
from .pandas_tester import NativeTestBackend, PandasTestBackend
from .plugins import (
FugueTestBackend,
FugueTestContext,
Expand Down
File renamed without changes.
7 changes: 3 additions & 4 deletions fugue/test/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
_FUGUE_TEST_BACKENDS: Dict[str, Type["FugueTestBackend"]] = {}
_FUGUE_TEST_ALL_INI_CONF: Dict[str, Any] = {}
_FUGUE_TEST_INI_FUGUE_CONF: Dict[str, Any] = {}
_FUGUE_BACKEND_SESSION_FIXTURES: Dict[str, Any] = {}


def _set_global_conf(conf: Dict[str, Any]) -> None:
Expand All @@ -30,8 +29,8 @@ def _get_all_ini_conf() -> Dict[str, Any]:
return _FUGUE_TEST_ALL_INI_CONF


def _get_all_backend_session_fixtures() -> Dict[str, Any]:
return _FUGUE_BACKEND_SESSION_FIXTURES
def _get_all_backends() -> Dict[str, Type["FugueTestBackend"]]:
return _FUGUE_TEST_BACKENDS


def _load_all_backends() -> None:
Expand All @@ -40,7 +39,7 @@ def _load_all_backends() -> None:
load_entry_point(FUGUE_ENTRYPOINT)


def with_backend(ctx: str, *other: str, skip_missing: bool = False) -> Any:
def with_backend(ctx: Any, *other: Any, skip_missing: bool = False) -> Any:
import pytest

_load_all_backends()
Expand Down
15 changes: 13 additions & 2 deletions fugue_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,22 @@ def tmp_mem_dir():
pass


@pytest.fixture(scope="session")
def pandas_session():
yield "pandas"


@pytest.fixture(scope="session")
def native_session():
yield "native"


@pytest.fixture(scope="class")
def backend_context(request: Any):
from fugue.test.plugins import _make_backend_context
from fugue.test.plugins import _make_backend_context, _parse_backend

session = request.getfixturevalue(request.param[0] + "_session")
c, _ = _parse_backend(request.param)
session = request.getfixturevalue(c + "_session")
with _make_backend_context(request.param, session) as ctx:
yield ctx

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_version() -> str:
],
"pytest11": [
"fugue_test = fugue_test",
"fugue_test_spark = fugue_spark.tester",
# "fugue_test_spark = fugue_spark.tester",
# "fugue_test_duckdb = fugue_duckdb.test_backend"
# "fugue_test_plugins = fugue.test.plugins",
# "fugue_test_fixtures = fugue.test.fixtures",
Expand Down
11 changes: 7 additions & 4 deletions tests/fugue/test/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@

import pytest

import fugue.test as ft
import fugue.api as fa
import fugue.test as ft
from fugue import NativeExecutionEngine

from fugue.test.pandas_backend import PandasTestBackend
from fugue_test import _parse_line


@ft.fugue_test_backend
class _MockPandasTestBackend(PandasTestBackend):
class _MockPandasTestBackend(ft.FugueTestBackend):
name = "pandas_test_test"
default_session_conf = {"a": 1, "aa": 2}
default_fugue_conf = {"fugue.b": 2}
Expand All @@ -26,6 +24,11 @@ def session_context(cls, session_conf: Dict[str, Any]) -> Iterator[Any]:
yield "pandas"


@pytest.fixture(scope="session")
def pandas_test_test_session():
yield "pandas"


@pytest.fixture(scope="session")
def f_dummy():
return 1
Expand Down

0 comments on commit 25d1ba5

Please sign in to comment.