Executing: 100%|██████████| 33/33 [00:42<00:00, 1.28s/cell]
tests\notebooks\test_notebooks.py:55 (test_notebook[C:\\Users\\mikap\\PycharmProjects\\bookshelf\\notebooks\\ceds\\ceds.py-ceds-v2021_04_21])
notebook_path = 'C:\\Users\\mikap\\PycharmProjects\\bookshelf\\notebooks\\ceds\\ceds.py'
notebook_name = 'ceds', notebook_version = 'v2021_04_21'
output_directory = 'C:\\Users\\mikap\\AppData\\Local\\Temp\\pytest-of-mikap\\pytest-24\\test_notebook_C___Users__mikap0'
@pytest.mark.parametrize("notebook_path,notebook_name,notebook_version", notebooks)
def test_notebook(notebook_path, notebook_name, notebook_version, output_directory):
# Check that:
# * notebooks run as expected
# * that hash matches an existing notebook
notebook_dir = os.path.dirname(notebook_path)
> run_notebook_and_check_results(
notebook_name,
version=notebook_version,
notebook_dir=notebook_dir,
output_directory=os.path.join(
output_directory, "sample", notebook_name, notebook_version
),
)
tests\notebooks\test_notebooks.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
notebook = 'ceds', version = 'v2021_04_21'
notebook_dir = 'C:\\Users\\mikap\\PycharmProjects\\bookshelf\\notebooks\\ceds'
output_directory = 'C:\\Users\\mikap\\AppData\\Local\\Temp\\pytest-of-mikap\\pytest-24\\test_notebook_C___Users__mikap0\\sample\\ceds\\v2021_04_21'
def run_notebook_and_check_results(notebook, version, notebook_dir, output_directory):
shelf = BookShelf()
try:
target_book = run_notebook(
notebook,
nb_directory=notebook_dir,
output_directory=output_directory,
version=version,
)
except UnknownBook:
logger.info("Book has not been pushed yet")
return
if shelf.is_available(name=target_book.name, version=target_book.version):
existing_book = shelf.load(
name=target_book.name, version=target_book.version, force=True
)
logger.info(f"Remote book exists. Expecting hash: {existing_book.hash()}")
if existing_book.edition != target_book.edition:
raise ValueError(
f"Edition of calculated book doesn't match the remote bookshelf "
f"({target_book.edition} != {existing_book.edition})"
)
if existing_book.hash() != target_book.hash():
> raise ValueError(
f"Hash of calculated book doesn't match the remote bookshelf "
f"({target_book.hash()} != {existing_book.hash()})"
)
E ValueError: Hash of calculated book doesn't match the remote bookshelf (aab946dd691d9e653e74d2c3c2f4b4f8d872785aa7f03f7a9dedc9261f5a93a4 != a5f5bae41ccd85dbc365c04538cf6a527379ceb494fee246c7c5bda8328be32e)
tests\notebooks\test_notebooks.py:101: ValueError
In GitLab by @mikapfl on Apr 12, 2023, 18:54
The problem
All notebook tests from
tests/test_notebooks/test_notebooks.pyfail on windows with aValueErrorbecause the hashes don't match.Definition of “done”
Additional context
Full Log of a failing test