Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notebook tests fail on windows #90

Open
1 task
lewisjared opened this issue Apr 12, 2023 · 1 comment
Open
1 task

notebook tests fail on windows #90

lewisjared opened this issue Apr 12, 2023 · 1 comment
Labels
triage As yet otherwise unlabelled issues (our default)

Comments

@lewisjared
Copy link
Contributor

In GitLab by @mikapfl on Apr 12, 2023, 18:54

The problem

All notebook tests from tests/test_notebooks/test_notebooks.py fail on windows with a ValueError because the hashes don't match.

Definition of “done”

  • All notebook tests pass on windows.

Additional context

Full Log of a failing test
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

@lewisjared
Copy link
Contributor Author

I'll see if I can reproduce on my VM otherwise I might need some results from you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage As yet otherwise unlabelled issues (our default)
Projects
None yet
Development

No branches or pull requests

1 participant