Skip to content

Commit

Permalink
Fix the daily notebook tests (#2952)
Browse files Browse the repository at this point in the history
  • Loading branch information
dakinggg committed Feb 1, 2024
1 parent 55d594a commit 58c69c6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/test_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
from urllib.parse import urlparse

import importlib_metadata
import pytest
import testbook
from testbook.client import TestbookNotebookClient
Expand All @@ -21,6 +22,16 @@
for nb in glob.glob(os.path.join(nb_root, '*.ipynb')) \
]

try:
importlib_metadata.files('mosaicml')
package_name = 'mosaicml'
except importlib_metadata.PackageNotFoundError:
try:
importlib_metadata.files('composer')
package_name = 'composer'
except importlib_metadata.PackageNotFoundError:
raise RuntimeError('Could not find the package under mosaicml or composer.')


def patch_notebooks():
import itertools
Expand Down Expand Up @@ -86,7 +97,6 @@ def modify_cell_source(tb: TestbookNotebookClient, notebook_name: str, cell_sour
cell_source = cell_source.replace('batch_size=256', 'batch_size=64')
cell_source = cell_source.replace('download=True', 'download=False')

package_name = os.environ.get('COMPOSER_PACKAGE_NAME', 'mosaicml')
cell_source = cell_source.replace("pip install 'mosaicml", f"pip install '{package_name}")
cell_source = cell_source.replace('pip install mosaicml', f'pip install {package_name}')

Expand Down

0 comments on commit 58c69c6

Please sign in to comment.