Skip to content

Commit

Permalink
improve dash import test
Browse files Browse the repository at this point in the history
see #1143
  • Loading branch information
alexcjohnson committed Dec 10, 2020
1 parent 2fa1883 commit 549140e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
command: |
. venv/bin/activate && pip install --no-cache-dir --upgrade -e . --progress-bar off && mkdir packages
cd dash-renderer && renderer build && python setup.py sdist && mv dist/* ../packages/ && cd ..
git clone --depth 1 https://github.com/plotly/dash-core-components.git
git clone --depth 1 -b import-test https://github.com/plotly/dash-core-components.git
cd dash-core-components && npm ci && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd ..
ls -la packages
- persist_to_workspace:
Expand Down
1 change: 1 addition & 0 deletions dash/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# __plotly_dash = True # for the "make sure you don't have a dash.py" check
from .dash import Dash, no_update # noqa: F401
from . import dependencies # noqa: F401
from . import development # noqa: F401
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"private::test.R.deploy-nested": "npm run private::test.setup-nested && cd \\@plotly/dash-generator-test-component-nested && sudo R CMD INSTALL .",
"private::test.R.deploy-standard": "npm run private::test.setup-standard && cd \\@plotly/dash-generator-test-component-standard && sudo R CMD INSTALL .",
"private::test.unit-dash": "pytest tests/unit",
"private::test.unit-dash-import": "cd tests && python dash_import_test.py",
"private::test.unit-renderer": "cd dash-renderer && npm run test",
"private::test.integration-dash": "TESTFILES=$(circleci tests glob \"tests/integration/**/test_*.py\" | circleci tests split --split-by=timings) && pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml ${TESTFILES}",
"format": "run-s private::format.*",
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/dash/dash_import_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# NOTE: this is NOT a pytest test. Just run it as a regular Python script.
# pytest does some magic that makes the issue we're trying to test disappear.

import types
import os

import dash

assert isinstance(dash, types.ModuleType), "dash can be imported"

this_dir = os.path.dirname(__file__)
with open(os.path.join(this_dir, "../../../dash/version.py")) as fp:
assert dash.__version__ in fp.read(), "version is consistent"

assert (
getattr(dash, "Dash").__name__ == "Dash"
), "access to main Dash class is valid"
3 changes: 3 additions & 0 deletions tests/unit/dash/org.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# used implicitly by dash_import_test
# to test https://github.com/plotly/dash/issues/1143
import dash_core_components as dcc # noqa: F401
14 changes: 0 additions & 14 deletions tests/unit/dash/test_dash_import.py

This file was deleted.

14 changes: 0 additions & 14 deletions tests/unit/test_import.py

This file was deleted.

0 comments on commit 549140e

Please sign in to comment.