Skip to content

Commit c81d61b

Browse files
authored
Improve some tests (#2278)
* Improve some tests * Fix
1 parent f4b31dd commit c81d61b

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

tests/by_image/all-spark-notebook/test_spark_r_nbconvert.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,5 @@ def test_spark_r_nbconvert(
3535
no_warnings=(not expected_warnings),
3636
)
3737

38-
if expected_warnings:
39-
warnings = TrackedContainer.get_warnings(logs)
40-
assert len(warnings) == len(expected_warnings)
41-
assert expected_warnings[0] == warnings[0]
38+
warnings = TrackedContainer.get_warnings(logs)
39+
assert warnings == expected_warnings

tests/by_image/pyspark-notebook/test_spark.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@ def test_spark_shell(container: TrackedContainer) -> None:
1515
command=["bash", "-c", 'spark-shell <<< "1+1"'],
1616
)
1717
warnings = TrackedContainer.get_warnings(logs)
18-
assert len(warnings) == 1
19-
assert "Using incubator modules: jdk.incubator.vector" in warnings[0]
20-
18+
assert warnings == ["WARNING: Using incubator modules: jdk.incubator.vector"]
2119
assert "res0: Int = 2" in logs, "spark-shell does not work"

tests/by_image/pyspark-notebook/test_spark_nbconvert.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@
1212
THIS_DIR = Path(__file__).parent.resolve()
1313

1414

15-
@pytest.mark.parametrize(
16-
"test_file",
17-
["issue_1168", "local_pyspark"],
18-
)
15+
@pytest.mark.parametrize("test_file", ["issue_1168", "local_pyspark"])
1916
@pytest.mark.parametrize("output_format", ["pdf", "html", "markdown"])
2017
def test_spark_nbconvert(
2118
container: TrackedContainer, test_file: str, output_format: str
2219
) -> None:
2320
host_data_file = THIS_DIR / "data" / f"{test_file}.ipynb"
2421
logs = check_nbconvert(
25-
container, host_data_file, "markdown", execute=True, no_warnings=False
22+
container, host_data_file, output_format, execute=True, no_warnings=False
2623
)
2724

2825
warnings = TrackedContainer.get_warnings(logs)
29-
assert len(warnings) == 1
30-
assert "Using incubator modules: jdk.incubator.vector" in warnings[0]
26+
assert warnings == ["WARNING: Using incubator modules: jdk.incubator.vector"]

0 commit comments

Comments
 (0)