diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6c9cbae08..422c4de62 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -55,7 +55,6 @@ jobs: channels: pyviz/label/dev,bokeh,conda-forge,nodefaults envs: -o tests -o sql cache: true - conda-mamba: mamba id: install - name: doit test_unit run: | diff --git a/lumen/tests/sources/test_duckdb.py b/lumen/tests/sources/test_duckdb.py index 744bcb3e2..3492fa1b2 100644 --- a/lumen/tests/sources/test_duckdb.py +++ b/lumen/tests/sources/test_duckdb.py @@ -15,6 +15,26 @@ pytestmark = pytest.mark.skipif(DuckDBSource is None, reason="Duckdb is not installed") +def assert_frame_equal_ignore_null_like(a, b): + """ + From Pandas 2.1 we are getting this FutureWarning: + Mismatched null-like values nan and None found. In a future version, + pandas equality-testing functions (e.g. assert_frame_equal) + will consider these not-matching and raise. + + Here we are converting all null-like values to np.nan. + + Could be that in future release we get a keyword argument to ignore + this strict behavior + + Reference: https://github.com/pandas-dev/pandas/pull/52081 + + """ + a = a.fillna(np.nan) + b = b.fillna(np.nan) + pd.testing.assert_frame_equal(a, b) + + @pytest.fixture def duckdb_source(): root = os.path.dirname(__file__) @@ -43,7 +63,10 @@ def test_duckdb_get_tables(duckdb_source, source_tables): tables = duckdb_source.get_tables() assert not len(set(tables) - set(source_tables.keys())) for table in tables: - pd.testing.assert_frame_equal(duckdb_source.get(table), source_tables[table]) + assert_frame_equal_ignore_null_like( + duckdb_source.get(table), + source_tables[table], + ) def test_duckdb_get_schema(duckdb_source): @@ -103,7 +126,7 @@ def test_duckdb_filter(duckdb_source, table_column_value_type, dask, expected_fi table, column, value, _ = table_column_value_type kwargs = {column: value} filtered = duckdb_source.get(table, __dask=dask, **kwargs) - pd.testing.assert_frame_equal(filtered, expected_filtered_df.reset_index(drop=True)) + assert_frame_equal_ignore_null_like(filtered, expected_filtered_df.reset_index(drop=True)) def test_duckdb_transforms(duckdb_source, source_tables): diff --git a/lumen/tests/ui/test_imports.py b/lumen/tests/ui/test_imports.py new file mode 100644 index 000000000..9710d0c7d --- /dev/null +++ b/lumen/tests/ui/test_imports.py @@ -0,0 +1,12 @@ +from pathlib import Path + +import pytest + +ui_path = Path(__file__).parents[2] / "ui" +ui_files = sorted(ui_path.glob("[!_]*.py")) + + +@pytest.mark.parametrize("file", sorted(ui_files), ids=lambda f: f.name) +def test_ui_import(file) -> None: + module_name = file.with_suffix("").name + __import__(f"lumen.ui.{module_name}") diff --git a/lumen/tests/validation/test_layout.py b/lumen/tests/validation/test_layout.py index 9dbc342f6..dc3f20a00 100644 --- a/lumen/tests/validation/test_layout.py +++ b/lumen/tests/validation/test_layout.py @@ -48,7 +48,7 @@ def test_layout_Facet(spec, msg): ), ( {"format": "csvs"}, - "Download component 'format' value failed validation: csvs", + "Download component 'format' value failed validation: .*?csvs", ), ), ids=["correct1", "correct2", "wrong_format"], diff --git a/lumen/tests/validation/test_views.py b/lumen/tests/validation/test_views.py index fc8c899fd..31ef41836 100644 --- a/lumen/tests/validation/test_views.py +++ b/lumen/tests/validation/test_views.py @@ -21,7 +21,7 @@ ), ( {"format": "csvs"}, - "Download component 'format' value failed validation: csvs", + "Download component 'format' value failed validation: .*?csvs", ), ), ids=["correct1", "correct2", "missing_required", "wrong_format"], @@ -51,7 +51,7 @@ def test_target_Download(spec, output): ), ( {"type": "download", "format": "csvs"}, - "DownloadView component 'format' value failed validation: csvs", + "DownloadView component 'format' value failed validation: .*?csvs", ), ( {"format": "csv"}, diff --git a/lumen/ui/layouts.py b/lumen/ui/layouts.py index 2086361b9..a923a4a34 100644 --- a/lumen/ui/layouts.py +++ b/lumen/ui/layouts.py @@ -218,7 +218,7 @@ class LayoutsEditor(WizardItem): title = param.String(default="") - spec = param.List(precedence=-1) + spec = param.List(allow_None=True, precedence=-1) sources = param.List(doc="Select a source") diff --git a/lumen/ui/views.py b/lumen/ui/views.py index 2e35340a9..f04bee241 100644 --- a/lumen/ui/views.py +++ b/lumen/ui/views.py @@ -30,7 +30,7 @@ class ViewsEditor(WizardItem): pipelines = param.List(label='Select a pipeline') - views = param.List() + views = param.List(allow_None=True) _template = """ View Editor @@ -202,7 +202,7 @@ class ViewGallery(WizardItem, Gallery): path = param.Foldername() - spec = param.List() + spec = param.List(allow_None=True) views = param.List(default=[], precedence=-1, doc=""" The list of views added to the dashboard.""") diff --git a/setup.py b/setup.py index 1243d9f57..d6c1c5c31 100644 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ def get_setup_version(reponame): 'pytest-cov', 'codecov', 'pre-commit', + 'matplotlib >=3.4', # Ubuntu + Python 3.9 installs old version matplotlib (3.3.2) ], 'doc': [ 'nbsite >=0.8.2',