1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
|
From: Roland Mas <roland.mas@entierement.net>
Date: Tue, 17 Dec 2024 11:23:04 +0100
Subject: Update location of test notebooks
---
testbook/tests/test_client.py | 2 +-
testbook/tests/test_datamodel.py | 2 +-
testbook/tests/test_execute.py | 16 ++++++++--------
testbook/tests/test_inject.py | 2 +-
testbook/tests/test_patch.py | 2 +-
testbook/tests/test_reference.py | 2 +-
testbook/tests/test_testbook.py | 22 +++++++++++-----------
7 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/testbook/tests/test_client.py b/testbook/tests/test_client.py
index 1d4350f..7d3a665 100644
--- a/testbook/tests/test_client.py
+++ b/testbook/tests/test_client.py
@@ -8,7 +8,7 @@ from testbook.exceptions import TestbookCellTagNotFoundError, TestbookExecuteRes
@pytest.fixture(scope='module')
def notebook():
- with testbook('testbook/tests/resources/inject.ipynb', execute=True) as tb:
+ with testbook('tests/resources/inject.ipynb', execute=True) as tb:
yield tb
diff --git a/testbook/tests/test_datamodel.py b/testbook/tests/test_datamodel.py
index 11acd88..df891ad 100644
--- a/testbook/tests/test_datamodel.py
+++ b/testbook/tests/test_datamodel.py
@@ -5,7 +5,7 @@ from testbook.testbook import testbook
@pytest.fixture(scope='module')
def notebook():
- with testbook('testbook/tests/resources/datamodel.ipynb', execute=True) as tb:
+ with testbook('tests/resources/datamodel.ipynb', execute=True) as tb:
yield tb
diff --git a/testbook/tests/test_execute.py b/testbook/tests/test_execute.py
index 8097487..dad6d4f 100644
--- a/testbook/tests/test_execute.py
+++ b/testbook/tests/test_execute.py
@@ -6,7 +6,7 @@ from testbook.exceptions import TestbookRuntimeError, TestbookError
@pytest.fixture(scope='module')
def notebook():
- with testbook('testbook/tests/resources/foo.ipynb', execute=True) as tb:
+ with testbook('tests/resources/foo.ipynb', execute=True) as tb:
yield tb
@@ -53,37 +53,37 @@ def test_testbook_with_execute_context_manager(notebook):
def test_testbook_range():
- with testbook('testbook/tests/resources/inject.ipynb') as tb:
+ with testbook('tests/resources/inject.ipynb') as tb:
tb.execute_cell(range(4))
assert tb.code_cells_executed == 4
- with testbook('testbook/tests/resources/inject.ipynb', execute=range(4)) as tb:
+ with testbook('tests/resources/inject.ipynb', execute=range(4)) as tb:
assert tb.code_cells_executed == 4
@pytest.mark.parametrize("slice_params, expected_result", [(('hello', 'str'), 6), ((2, 5), 4)])
def test_testbook_slice(slice_params, expected_result):
- with testbook('testbook/tests/resources/inject.ipynb') as tb:
+ with testbook('tests/resources/inject.ipynb') as tb:
tb.execute_cell(slice(*slice_params))
assert tb.code_cells_executed == expected_result
- with testbook('testbook/tests/resources/inject.ipynb', execute=slice(*slice_params)) as tb:
+ with testbook('tests/resources/inject.ipynb', execute=slice(*slice_params)) as tb:
assert tb.code_cells_executed == expected_result
def test_testbook_slice_raises_error():
with pytest.raises(TestbookError):
- with testbook('testbook/tests/resources/inject.ipynb', execute=slice(3, 1, -1)):
+ with testbook('tests/resources/inject.ipynb', execute=slice(3, 1, -1)):
pass
-@testbook('testbook/tests/resources/exception.ipynb', execute=True)
+@testbook('tests/resources/exception.ipynb', execute=True)
def test_raise_exception(tb):
with pytest.raises(TestbookRuntimeError):
tb.ref("raise_my_exception")()
-@testbook('testbook/tests/resources/inject.ipynb')
+@testbook('tests/resources/inject.ipynb')
def test_underscore(tb):
tb.inject(
"""
diff --git a/testbook/tests/test_inject.py b/testbook/tests/test_inject.py
index fe266a4..d09b641 100644
--- a/testbook/tests/test_inject.py
+++ b/testbook/tests/test_inject.py
@@ -5,7 +5,7 @@ from testbook.testbook import testbook
@pytest.fixture(scope='module')
def notebook():
- with testbook('testbook/tests/resources/inject.ipynb', execute=True) as tb:
+ with testbook('tests/resources/inject.ipynb', execute=True) as tb:
yield tb
diff --git a/testbook/tests/test_patch.py b/testbook/tests/test_patch.py
index d0e71b8..6d76a36 100644
--- a/testbook/tests/test_patch.py
+++ b/testbook/tests/test_patch.py
@@ -6,7 +6,7 @@ import pytest
@pytest.fixture(scope='module')
def tb():
- with testbook('testbook/tests/resources/patch.ipynb', execute=True) as tb:
+ with testbook('tests/resources/patch.ipynb', execute=True) as tb:
yield tb
diff --git a/testbook/tests/test_reference.py b/testbook/tests/test_reference.py
index 94c9ae3..5779b28 100644
--- a/testbook/tests/test_reference.py
+++ b/testbook/tests/test_reference.py
@@ -6,7 +6,7 @@ from testbook.exceptions import TestbookAttributeError, TestbookSerializeError
@pytest.fixture(scope='module')
def notebook():
- with testbook('testbook/tests/resources/reference.ipynb', execute=True) as tb:
+ with testbook('tests/resources/reference.ipynb', execute=True) as tb:
yield tb
diff --git a/testbook/tests/test_testbook.py b/testbook/tests/test_testbook.py
index b947de7..01fe36e 100644
--- a/testbook/tests/test_testbook.py
+++ b/testbook/tests/test_testbook.py
@@ -5,57 +5,57 @@ import pytest
from testbook.testbook import testbook
-@testbook('testbook/tests/resources/inject.ipynb', execute=True)
+@testbook('tests/resources/inject.ipynb', execute=True)
def test_testbook_execute_all_cells(tb):
for cell in tb.cells[:-1]:
assert cell.execution_count
-@testbook('testbook/tests/resources/inject.ipynb', execute='hello')
+@testbook('tests/resources/inject.ipynb', execute='hello')
def test_testbook_class_decorator(tb):
assert tb.inject("say_hello()")
-@testbook('testbook/tests/resources/inject.ipynb')
+@testbook('tests/resources/inject.ipynb')
def test_testbook_class_decorator_execute_none(tb):
assert tb.code_cells_executed == 0
-@testbook('testbook/tests/resources/inject.ipynb', execute=True)
+@testbook('tests/resources/inject.ipynb', execute=True)
def test_testbook_decorator_with_fixture(nb, tmp_path):
assert True # Check that the decorator accept to be passed along side a fixture
-@testbook('testbook/tests/resources/inject.ipynb', execute=True)
+@testbook('tests/resources/inject.ipynb', execute=True)
@pytest.mark.parametrize("cell_index_args, expected_result", [(2, 2), ('hello', 1)])
def test_testbook_decorator_with_markers(nb, cell_index_args, expected_result):
assert nb._cell_index(cell_index_args) == expected_result
@pytest.mark.parametrize("cell_index_args, expected_result", [(2, 2), ('hello', 1)])
-@testbook('testbook/tests/resources/inject.ipynb', execute=True)
+@testbook('tests/resources/inject.ipynb', execute=True)
def test_testbook_decorator_with_markers_order_does_not_matter(nb, cell_index_args, expected_result):
assert nb._cell_index(cell_index_args) == expected_result
def test_testbook_execute_all_cells_context_manager():
- with testbook('testbook/tests/resources/inject.ipynb', execute=True) as tb:
+ with testbook('tests/resources/inject.ipynb', execute=True) as tb:
for cell in tb.cells[:-1]:
assert cell.execution_count
def test_testbook_class_decorator_context_manager():
- with testbook('testbook/tests/resources/inject.ipynb', execute='hello') as tb:
+ with testbook('tests/resources/inject.ipynb', execute='hello') as tb:
assert tb.inject("say_hello()")
def test_testbook_class_decorator_execute_none_context_manager():
- with testbook('testbook/tests/resources/inject.ipynb') as tb:
+ with testbook('tests/resources/inject.ipynb') as tb:
assert tb.code_cells_executed == 0
def test_testbook_with_file_object():
- f = open('testbook/tests/resources/inject.ipynb')
+ f = open('tests/resources/inject.ipynb')
with testbook(f) as tb:
assert tb.code_cells_executed == 0
@@ -64,7 +64,7 @@ def test_testbook_with_file_object():
def test_testbook_with_notebook_node():
- nb = nbformat.read('testbook/tests/resources/inject.ipynb', as_version=4)
+ nb = nbformat.read('tests/resources/inject.ipynb', as_version=4)
with testbook(nb) as tb:
assert tb.code_cells_executed == 0
|