Skip to content

Commit d36a9ee

Browse files
committed
Minor refactor
1 parent c2fe63f commit d36a9ee

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/pytest_split/ipynb_compatibility.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ def ensure_ipynb_compatibility(group: "TestGroup", items: "List[nodes.Item]") ->
1919
will raise ``NameError``).
2020
2121
"""
22+
if not group.selected or not _is_ipy_notebook(group.selected[0].nodeid):
23+
return
24+
2225
item_node_ids = [item.nodeid for item in items]
2326

2427
# Deal with broken up notebooks at the beginning of the test group
25-
if not group.selected or not _is_ipy_notebook(group.selected[0].nodeid):
26-
return
2728
first = group.selected[0].nodeid
2829
siblings = _find_sibiling_ipynb_cells(first, item_node_ids)
2930
if first != siblings[0]:
@@ -32,9 +33,10 @@ def ensure_ipynb_compatibility(group: "TestGroup", items: "List[nodes.Item]") ->
3233
group.deselected.append(item)
3334
group.selected.remove(item)
3435

35-
# Deal with broken up notebooks at the end of the test group
3636
if not group.selected or not _is_ipy_notebook(group.selected[-1].nodeid):
3737
return
38+
39+
# Deal with broken up notebooks at the end of the test group
3840
last = group.selected[-1].nodeid
3941
siblings = _find_sibiling_ipynb_cells(last, item_node_ids)
4042
if last != siblings[-1]:

0 commit comments

Comments
 (0)