Skip to content

Commit c2fe63f

Browse files
committed
Rename _reorganize_ipynb... to ensure_ipynb_compatibility
1 parent 2c240f8 commit c2fe63f

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/pytest_split/ipynb_compatibility.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pytest_split.algorithms import TestGroup
99

1010

11-
def _reorganize_broken_up_ipynbs(group: "TestGroup", items: "List[nodes.Item]") -> None:
11+
def ensure_ipynb_compatibility(group: "TestGroup", items: "List[nodes.Item]") -> None:
1212
"""
1313
Ensures that group doesn't contain partial IPy notebook cells.
1414
@@ -44,7 +44,9 @@ def _reorganize_broken_up_ipynbs(group: "TestGroup", items: "List[nodes.Item]")
4444
group.selected.append(item)
4545

4646

47-
def _find_sibiling_ipynb_cells(ipynb_node_id: str, item_node_ids: "List[str]") -> "List[str]":
47+
def _find_sibiling_ipynb_cells(
48+
ipynb_node_id: str, item_node_ids: "List[str]"
49+
) -> "List[str]":
4850
"""
4951
Returns all sibiling IPyNb cells given an IPyNb cell nodeid.
5052
"""

src/pytest_split/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from _pytest.reports import TestReport
88

99
from pytest_split import algorithms
10-
from pytest_split.ipynb_compatibility import _reorganize_broken_up_ipynbs
10+
from pytest_split.ipynb_compatibility import ensure_ipynb_compatibility
1111

1212
if TYPE_CHECKING:
1313
from typing import Dict, List, Optional, Union
@@ -167,7 +167,7 @@ def pytest_collection_modifyitems(
167167
groups = algo(splits, items, self.cached_durations)
168168
group = groups[group_idx - 1]
169169

170-
_reorganize_broken_up_ipynbs(group, items)
170+
ensure_ipynb_compatibility(group, items)
171171

172172
items[:] = group.selected
173173
config.hook.pytest_deselected(items=group.deselected)

tests/test_ipynb.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import pytest
44

55
from pytest_split.algorithms import Algorithms
6-
from pytest_split.ipynb_compatibility import _reorganize_broken_up_ipynbs
6+
from pytest_split.ipynb_compatibility import ensure_ipynb_compatibility
77

88
item = namedtuple("item", "nodeid")
99

1010

1111
class TestIPyNb:
1212
@pytest.mark.parametrize("algo_name", ["duration_based_chunks"])
13-
def test__reorganize_broken_up_ipynbs(self, algo_name):
13+
def test_ensure_ipynb_compatibility(self, algo_name):
1414
durations = {
1515
"temp/nbs/test_1.ipynb::Cell 0": 1,
1616
"temp/nbs/test_1.ipynb::Cell 1": 1,
@@ -54,7 +54,7 @@ def test__reorganize_broken_up_ipynbs(self, algo_name):
5454
item(nodeid="temp/nbs/test_4.ipynb::Cell 2"),
5555
]
5656

57-
_reorganize_broken_up_ipynbs(groups[0], items)
57+
ensure_ipynb_compatibility(groups[0], items)
5858
assert groups[0].selected == [
5959
item(nodeid="temp/nbs/test_1.ipynb::Cell 0"),
6060
item(nodeid="temp/nbs/test_1.ipynb::Cell 1"),
@@ -65,7 +65,7 @@ def test__reorganize_broken_up_ipynbs(self, algo_name):
6565
item(nodeid="temp/nbs/test_2.ipynb::Cell 3"),
6666
]
6767

68-
_reorganize_broken_up_ipynbs(groups[1], items)
68+
ensure_ipynb_compatibility(groups[1], items)
6969
assert groups[1].selected == [
7070
item(nodeid="temp/nbs/test_3.ipynb::Cell 0"),
7171
item(nodeid="temp/nbs/test_3.ipynb::Cell 1"),
@@ -74,7 +74,7 @@ def test__reorganize_broken_up_ipynbs(self, algo_name):
7474
item(nodeid="temp/nbs/test_3.ipynb::Cell 4"),
7575
]
7676

77-
_reorganize_broken_up_ipynbs(groups[2], items)
77+
ensure_ipynb_compatibility(groups[2], items)
7878
assert groups[2].selected == [
7979
item(nodeid="temp/nbs/test_4.ipynb::Cell 0"),
8080
item(nodeid="temp/nbs/test_4.ipynb::Cell 1"),

0 commit comments

Comments
 (0)