Skip to content

Commit

Permalink
Revert changes to examples so that integration tests still pass
Browse files Browse the repository at this point in the history
  • Loading branch information
antonymilne committed Nov 8, 2023
1 parent 2af705d commit 9110267
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Removed
- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Added
- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Changed
- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Deprecated
- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Fixed
- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Security
- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
3 changes: 0 additions & 3 deletions vizro-core/examples/default/app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
"""Example to show dashboard configuration."""
import os

import dash
import flask
import pandas as pd

import vizro.models as vm
Expand Down
1 change: 0 additions & 1 deletion vizro-core/examples/from_dict/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Example to show dashboard configuration specified as a dictionary."""
import os

import pandas as pd

Expand Down
1 change: 0 additions & 1 deletion vizro-core/examples/from_json/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Example to show dashboard configuration specified as a JSON file."""
import json
import os
from pathlib import Path

import pandas as pd
Expand Down
1 change: 0 additions & 1 deletion vizro-core/examples/from_yaml/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Example to show dashboard configuration specified as a YAML file."""
import os
from pathlib import Path

import pandas as pd
Expand Down
8 changes: 4 additions & 4 deletions vizro-core/src/vizro/_vizro.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging
import os
from pathlib import Path, PosixPath
from typing import Dict, List, Tuple
from pathlib import Path
from typing import List

import dash
import flask
Expand Down Expand Up @@ -101,7 +100,8 @@ def _reset():
@staticmethod
def _get_external_assets(new_path: str, folder: Path, extension: str) -> List[str]:
"""Returns a list of paths to assets with given extension in folder, prefixed with new_path.
e.g. with new_path="/vizro", extension="css", folder="/path/to/vizro/vizro-core/src/vizro/static",
we will get ["/vizro/css/accordion.css", "/vizro/css/button.css", ...]
we will get ["/vizro/css/accordion.css", "/vizro/css/button.css", ...].
"""
return sorted((new_path / path.relative_to(folder)).as_posix() for path in folder.rglob(f"*.{extension}"))
2 changes: 1 addition & 1 deletion vizro-core/src/vizro/models/_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import dash_bootstrap_components as dbc
import dash_daq as daq
import plotly.io as pio
from dash import ClientsideFunction, Input, Output, clientside_callback, html, get_relative_path
from dash import ClientsideFunction, Input, Output, clientside_callback, get_relative_path, html
from pydantic import Field, validator

import vizro
Expand Down
1 change: 0 additions & 1 deletion vizro-core/tests/integration/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def setup_integration_test_environment(monkeypatch_session):
# We only need to install chromedriver outside CI.
if not os.getenv("CI"):
chromedriver_autoinstaller_fix.install()
print("Done setting up integration test environment.")


@pytest.fixture
Expand Down
3 changes: 2 additions & 1 deletion vizro-core/tests/unit/vizro/models/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def test_dashboard_page_registry(self, dashboard, mock_page_registry):
# Str conversion required as comparison of OrderedDict values result in False otherwise
assert str(result.items()) == str(expected.items())

def test_create_layout_page_404(self, dashboard):
def test_create_layout_page_404(self, dashboard, mocker):
mocker.patch("vizro.models._dashboard.get_relative_path")
result = dashboard._make_page_404_layout()
result_image = result.children[0]
result_div = result.children[1]
Expand Down

0 comments on commit 9110267

Please sign in to comment.