|
4 | 4 |
|
5 | 5 | from importlib import import_module
|
6 | 6 | from pathlib import Path
|
| 7 | +import warnings |
7 | 8 |
|
8 | 9 | from dash import Dash, Input, Output, callback
|
9 | 10 | from dash.dash_table import DataTable
|
@@ -40,23 +41,39 @@ def get_all_tests(
|
40 | 41 |
|
41 | 42 | # Build all layouts, and register all callbacks to main app.
|
42 | 43 | for test in tests:
|
43 |
| - # Import tab application layout/callbacks |
44 |
| - test_name = test.parent.name |
45 |
| - category_name = test.parent.parent.name |
46 |
| - test_module = import_module( |
47 |
| - f"mlip_testing.app.{category_name}.{test_name}.app_{test_name}" |
48 |
| - ) |
49 |
| - test_app = test_module.get_app() |
50 |
| - |
51 |
| - # Get layouts and tables for each category/test |
52 |
| - if category_name not in layouts: |
53 |
| - layouts[category_name] = {} |
54 |
| - tables[category_name] = {} |
55 |
| - layouts[category_name][test_app.name] = test_app.layout |
56 |
| - tables[category_name][test_app.name] = test_app.table |
| 44 | + try: |
| 45 | + # Import tab application layout/callbacks |
| 46 | + test_name = test.parent.name |
| 47 | + category_name = test.parent.parent.name |
| 48 | + test_module = import_module( |
| 49 | + f"mlip_testing.app.{category_name}.{test_name}.app_{test_name}" |
| 50 | + ) |
| 51 | + test_app = test_module.get_app() |
| 52 | + |
| 53 | + # Get layouts and tables for each category/test |
| 54 | + if category_name not in layouts: |
| 55 | + layouts[category_name] = {} |
| 56 | + tables[category_name] = {} |
| 57 | + layouts[category_name][test_app.name] = test_app.layout |
| 58 | + tables[category_name][test_app.name] = test_app.table |
| 59 | + except FileNotFoundError as err: |
| 60 | + warnings.warn( |
| 61 | + f"Unable to load layout for {test_name} in {category_name} category. " |
| 62 | + f"Full error:\n{err}", |
| 63 | + stacklevel=2, |
| 64 | + ) |
| 65 | + continue |
57 | 66 |
|
58 | 67 | # Register tab callbacks
|
59 |
| - test_app.register_callbacks() |
| 68 | + try: |
| 69 | + test_app.register_callbacks() |
| 70 | + except FileNotFoundError as err: |
| 71 | + warnings.warn( |
| 72 | + f"Unable to register callbacks for {test_name} in {category_name} " |
| 73 | + f"category. Full error:\n{err}", |
| 74 | + stacklevel=2, |
| 75 | + ) |
| 76 | + continue |
60 | 77 |
|
61 | 78 | return layouts, tables
|
62 | 79 |
|
|
0 commit comments