sparkless-testing 0.2.0__tar.gz → 4.20.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. sparkless_testing-4.20.0/PKG-INFO +45 -0
  2. sparkless_testing-4.20.0/README.md +33 -0
  3. sparkless_testing-4.20.0/pyproject.toml +23 -0
  4. sparkless_testing-4.20.0/sparkless_testing/__init__.py +120 -0
  5. sparkless_testing-4.20.0/sparkless_testing/comparison.py +535 -0
  6. sparkless_testing-4.20.0/sparkless_testing/compat.py +28 -0
  7. sparkless_testing-4.20.0/sparkless_testing/fixtures.py +265 -0
  8. sparkless_testing-4.20.0/sparkless_testing/imports.py +214 -0
  9. sparkless_testing-4.20.0/sparkless_testing/jdbc.py +311 -0
  10. sparkless_testing-4.20.0/sparkless_testing/mode.py +120 -0
  11. sparkless_testing-4.20.0/sparkless_testing/plugin.py +126 -0
  12. sparkless_testing-4.20.0/sparkless_testing/session.py +532 -0
  13. sparkless_testing-4.20.0/sparkless_testing.egg-info/PKG-INFO +45 -0
  14. sparkless_testing-4.20.0/sparkless_testing.egg-info/SOURCES.txt +17 -0
  15. sparkless_testing-4.20.0/sparkless_testing.egg-info/requires.txt +1 -0
  16. sparkless_testing-0.2.0/LICENSE +0 -22
  17. sparkless_testing-0.2.0/PKG-INFO +0 -423
  18. sparkless_testing-0.2.0/README.md +0 -385
  19. sparkless_testing-0.2.0/pyproject.toml +0 -138
  20. sparkless_testing-0.2.0/sparkless_testing/__init__.py +0 -87
  21. sparkless_testing-0.2.0/sparkless_testing/conftest.py +0 -39
  22. sparkless_testing-0.2.0/sparkless_testing/engine.py +0 -306
  23. sparkless_testing-0.2.0/sparkless_testing/parametrize.py +0 -149
  24. sparkless_testing-0.2.0/sparkless_testing/protocols.py +0 -145
  25. sparkless_testing-0.2.0/sparkless_testing/pytest_fixtures.py +0 -233
  26. sparkless_testing-0.2.0/sparkless_testing/session.py +0 -244
  27. sparkless_testing-0.2.0/sparkless_testing/utils.py +0 -209
  28. sparkless_testing-0.2.0/sparkless_testing.egg-info/PKG-INFO +0 -423
  29. sparkless_testing-0.2.0/sparkless_testing.egg-info/SOURCES.txt +0 -22
  30. sparkless_testing-0.2.0/sparkless_testing.egg-info/requires.txt +0 -15
  31. sparkless_testing-0.2.0/tests/test_engine.py +0 -389
  32. sparkless_testing-0.2.0/tests/test_fixtures.py +0 -344
  33. sparkless_testing-0.2.0/tests/test_parametrize.py +0 -150
  34. sparkless_testing-0.2.0/tests/test_session.py +0 -666
  35. sparkless_testing-0.2.0/tests/test_utils.py +0 -428
  36. {sparkless_testing-0.2.0 → sparkless_testing-4.20.0}/setup.cfg +0 -0
  37. {sparkless_testing-0.2.0 → sparkless_testing-4.20.0}/sparkless_testing/py.typed +0 -0
  38. {sparkless_testing-0.2.0 → sparkless_testing-4.20.0}/sparkless_testing.egg-info/dependency_links.txt +0 -0
  39. {sparkless_testing-0.2.0 → sparkless_testing-4.20.0}/sparkless_testing.egg-info/top_level.txt +0 -0
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.4
2
+ Name: sparkless-testing
3
+ Version: 4.20.0
4
+ Summary: Backend-independent pytest helpers for Sparkless and PySpark test suites.
5
+ License: MIT
6
+ Project-URL: Homepage, https://github.com/eddiethedean/robin-sparkless
7
+ Project-URL: Documentation, https://robin-sparkless.readthedocs.io/
8
+ Project-URL: Repository, https://github.com/eddiethedean/robin-sparkless
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: pytest>=7
12
+
13
+ # sparkless-testing
14
+
15
+ Backend-independent pytest fixtures and helpers for test suites that run against
16
+ Sparkless or PySpark. Install `sparkless[testing]` when testing a Sparkless
17
+ application, or install `sparkless-testing` directly for a suite that selects its
18
+ backend independently.
19
+
20
+ ```bash
21
+ python -m pip install "sparkless[testing]==4.20.0"
22
+ ```
23
+
24
+ Add this to your suite's root `conftest.py` to load the fixtures and backend
25
+ markers:
26
+
27
+ ```python
28
+ pytest_plugins = ["sparkless_testing.plugin"]
29
+ ```
30
+
31
+ Use the `spark` fixture in your tests. It selects Sparkless by default. To
32
+ run the same tests on a local PySpark installation, set `SPARKLESS_TEST_MODE=pyspark`.
33
+ The [testing guide](https://robin-sparkless.readthedocs.io/en/latest/TESTING_GUIDE/)
34
+ covers PySpark and Java setup and the compatibility profiles.
35
+
36
+ Use `compare_dataframes()` for structured row, ordered-column, and schema
37
+ results, or `assert_dataframes_equal()` to fail a test on any difference. Schema
38
+ checks cover names/order, types, nullability, declared metadata, decimals, and
39
+ nested struct/array/map fields. An expected mapping can declare `schema` and an
40
+ empty `data` list. See the
41
+ [comparison API contract](https://robin-sparkless.readthedocs.io/en/latest/TESTING_PYTHON_API/#comparison-semantics).
42
+
43
+ The published 4.19.0 package had the schema comparison defect in
44
+ [#1746](https://github.com/eddiethedean/robin-sparkless/issues/1746). Version
45
+ 4.20.0 fixes schema comparison for empty results and nested types.
@@ -0,0 +1,33 @@
1
+ # sparkless-testing
2
+
3
+ Backend-independent pytest fixtures and helpers for test suites that run against
4
+ Sparkless or PySpark. Install `sparkless[testing]` when testing a Sparkless
5
+ application, or install `sparkless-testing` directly for a suite that selects its
6
+ backend independently.
7
+
8
+ ```bash
9
+ python -m pip install "sparkless[testing]==4.20.0"
10
+ ```
11
+
12
+ Add this to your suite's root `conftest.py` to load the fixtures and backend
13
+ markers:
14
+
15
+ ```python
16
+ pytest_plugins = ["sparkless_testing.plugin"]
17
+ ```
18
+
19
+ Use the `spark` fixture in your tests. It selects Sparkless by default. To
20
+ run the same tests on a local PySpark installation, set `SPARKLESS_TEST_MODE=pyspark`.
21
+ The [testing guide](https://robin-sparkless.readthedocs.io/en/latest/TESTING_GUIDE/)
22
+ covers PySpark and Java setup and the compatibility profiles.
23
+
24
+ Use `compare_dataframes()` for structured row, ordered-column, and schema
25
+ results, or `assert_dataframes_equal()` to fail a test on any difference. Schema
26
+ checks cover names/order, types, nullability, declared metadata, decimals, and
27
+ nested struct/array/map fields. An expected mapping can declare `schema` and an
28
+ empty `data` list. See the
29
+ [comparison API contract](https://robin-sparkless.readthedocs.io/en/latest/TESTING_PYTHON_API/#comparison-semantics).
30
+
31
+ The published 4.19.0 package had the schema comparison defect in
32
+ [#1746](https://github.com/eddiethedean/robin-sparkless/issues/1746). Version
33
+ 4.20.0 fixes schema comparison for empty results and nested types.
@@ -0,0 +1,23 @@
1
+ [project]
2
+ name = "sparkless-testing"
3
+ version = "4.20.0"
4
+ description = "Backend-independent pytest helpers for Sparkless and PySpark test suites."
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = { text = "MIT" }
8
+ dependencies = ["pytest>=7"]
9
+
10
+ [project.urls]
11
+ Homepage = "https://github.com/eddiethedean/robin-sparkless"
12
+ Documentation = "https://robin-sparkless.readthedocs.io/"
13
+ Repository = "https://github.com/eddiethedean/robin-sparkless"
14
+
15
+ [build-system]
16
+ requires = ["setuptools>=77"]
17
+ build-backend = "setuptools.build_meta"
18
+
19
+ [tool.setuptools]
20
+ packages = ["sparkless_testing"]
21
+
22
+ [tool.setuptools.package-data]
23
+ sparkless_testing = ["py.typed"]
@@ -0,0 +1,120 @@
1
+ """Dual sparkless/pyspark testing framework.
2
+
3
+ This module provides a unified API for writing tests that can run against
4
+ both sparkless (Rust/Polars) and PySpark backends. Use the SPARKLESS_TEST_MODE
5
+ environment variable to switch between modes:
6
+
7
+ - SPARKLESS_TEST_MODE=sparkless (default): Run with sparkless
8
+ - SPARKLESS_TEST_MODE=pyspark: Run with PySpark
9
+
10
+ Quick Start (for external projects):
11
+
12
+ 1. Add to your conftest.py:
13
+
14
+ pytest_plugins = ["sparkless_testing.plugin"]
15
+
16
+ 2. Use the `spark` fixture in your tests:
17
+
18
+ def test_filter(spark):
19
+ df = spark.createDataFrame([(1, "a"), (2, "b")], ["id", "val"])
20
+ result = df.filter(df.id > 1).collect()
21
+ assert len(result) == 1
22
+
23
+ 3. Run tests:
24
+
25
+ # Run with sparkless (default)
26
+ pytest tests/
27
+
28
+ # Run with PySpark
29
+ SPARKLESS_TEST_MODE=pyspark pytest tests/
30
+
31
+ For more control, use the module directly:
32
+
33
+ from sparkless_testing import Mode, create_session, get_imports
34
+
35
+ spark = create_session(mode=Mode.SPARKLESS)
36
+ imports = get_imports()
37
+ F = imports.F
38
+
39
+ Example usage with comparison utilities:
40
+
41
+ from sparkless_testing import assert_dataframes_equal, assert_rows_equal
42
+
43
+ def test_transform(spark):
44
+ df1 = transform_a(spark)
45
+ df2 = transform_b(spark)
46
+ assert_dataframes_equal(df1, df2, check_order=False)
47
+ """
48
+
49
+ from __future__ import annotations
50
+
51
+ # Mode detection and configuration
52
+ from .mode import (
53
+ Mode,
54
+ ENV_VAR_NAME,
55
+ get_mode,
56
+ is_pyspark_mode,
57
+ is_sparkless_mode,
58
+ set_mode,
59
+ )
60
+
61
+ from .compat import (
62
+ ENV_COMPAT,
63
+ DEFAULT_COMPAT,
64
+ get_compat_profile,
65
+ apply_compat_to_session,
66
+ )
67
+
68
+ # Session creation
69
+ from .session import create_session
70
+
71
+ # Unified imports
72
+ from .imports import SparkImports, get_imports
73
+
74
+ # Comparison utilities
75
+ from .comparison import (
76
+ ComparisonResult,
77
+ compare_dataframes,
78
+ assert_dataframes_equal,
79
+ assert_rows_equal,
80
+ )
81
+
82
+ # Pytest fixtures (for direct import if not using plugin)
83
+ from .fixtures import (
84
+ spark,
85
+ spark_mode,
86
+ spark_imports,
87
+ isolated_session,
88
+ table_prefix,
89
+ )
90
+
91
+ __all__ = [
92
+ # Mode
93
+ "Mode",
94
+ "ENV_VAR_NAME",
95
+ "get_mode",
96
+ "is_pyspark_mode",
97
+ "is_sparkless_mode",
98
+ "set_mode",
99
+ # Compat profile
100
+ "ENV_COMPAT",
101
+ "DEFAULT_COMPAT",
102
+ "get_compat_profile",
103
+ "apply_compat_to_session",
104
+ # Session
105
+ "create_session",
106
+ # Imports
107
+ "SparkImports",
108
+ "get_imports",
109
+ # Comparison
110
+ "ComparisonResult",
111
+ "compare_dataframes",
112
+ "assert_dataframes_equal",
113
+ "assert_rows_equal",
114
+ # Fixtures
115
+ "spark",
116
+ "spark_mode",
117
+ "spark_imports",
118
+ "isolated_session",
119
+ "table_prefix",
120
+ ]