Skip to content

Commit 32a5d0e

Browse files
committed
open notebook as binary
1 parent 577e894 commit 32a5d0e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/nbmake/pytest_items.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pygments.lexers import Python3TracebackLexer
1212

1313
from .nb_result import NotebookError, NotebookResult
14-
from .nb_run import NotebookRun
14+
from .nb_run import NB_VERSION, NotebookRun
1515

1616

1717
class NbMakeFailureRepr(TerminalRepr):
@@ -27,7 +27,8 @@ class NotebookFile(pytest.File):
2727
def collect(self) -> Generator[Any, Any, Any]:
2828
item = NotebookItem.from_parent(self, filename=str(Path(self.fspath)))
2929

30-
nb = nbformat.read(self.fspath, 4)
30+
with open(self.fspath, "rb") as fp:
31+
nb = nbformat.read(fp, NB_VERSION)
3132

3233
try:
3334
markers = nb.metadata.execution.markers

0 commit comments

Comments
 (0)