From 0db64992a0e94f60d198a2222798a09333e29e0e Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Tue, 17 Nov 2020 11:24:37 -0500 Subject: [PATCH 1/8] Remove pytest-baseurl --- Makefile | 12 ++++++------ environment.yml | 2 +- python/jupyter_flex/tests/test_examples.py | 22 +++++++++++++--------- python/requirements.txt | 2 +- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 2cf33647..b213d9af 100644 --- a/Makefile +++ b/Makefile @@ -135,20 +135,20 @@ test-setup: test: test-setup ## Run tests - cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --port $(SELENIUM_HUB_PORT) --capability browserName chrome \ - --base-url $(PYTEST_BASE_URL) --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots --needle-output-dir test-results/screenshots \ + cd $(CURDIR)/python; PYTEST_BASE_URL=$(PYTEST_BASE_URL) pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ + --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots --needle-output-dir test-results/screenshots \ -k $(PYTEST_K) -m $(TEST_MARKERS) --html=test-results/report.html --self-contained-html test-all: test-setup ## Run all tests - cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --port $(SELENIUM_HUB_PORT) --capability browserName chrome \ - --base-url $(PYTEST_BASE_URL) --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots --needle-output-dir test-results/screenshots \ + cd $(CURDIR)/python; PYTEST_BASE_URL=$(PYTEST_BASE_URL) pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ + --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots --needle-output-dir test-results/screenshots \ -k $(PYTEST_K) --html=test-results/report.html --self-contained-html test-baselines: ## Create test baselines - cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --port $(SELENIUM_HUB_PORT) --capability browserName chrome \ - --base-url $(PYTEST_BASE_URL) --needle-save-baseline --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots \ + cd $(CURDIR)/python; PYTEST_BASE_URL=$(PYTEST_BASE_URL) pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ + --needle-save-baseline --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots \ -s -k $(PYTEST_K) diff --git a/environment.yml b/environment.yml index b4cd8e02..a50b4860 100644 --- a/environment.yml +++ b/environment.yml @@ -26,7 +26,7 @@ dependencies: - jupyter-flex>=0.6.4 - pytest-html - pytest-needle - - pytest-base-url + # - pytest-base-url - pytest-selenium - pytest-tornasync diff --git a/python/jupyter_flex/tests/test_examples.py b/python/jupyter_flex/tests/test_examples.py index 87e3a00d..1acb2150 100644 --- a/python/jupyter_flex/tests/test_examples.py +++ b/python/jupyter_flex/tests/test_examples.py @@ -1,9 +1,11 @@ +import os import time import pytest pytestmark = [pytest.mark.nondestructive] +base_url = os.environ.get("PYTEST_BASE_URL", "http://localhost:8866") @pytest.fixture @@ -28,11 +30,13 @@ def test_example_site(needle, myselenium): ("404-voila", "voila/render/fake-page-404"), ], ) -def test_voila(needle, myselenium, base_url, name, path): +def test_voila(needle, myselenium, name, path): target_url = "{0}/{1}".format(base_url, path) needle.driver.get(target_url) # Wait for page components to render + import os + time.sleep(2) # Take an element screen diff @@ -42,7 +46,7 @@ def test_voila(needle, myselenium, base_url, name, path): @pytest.mark.parametrize( "nb_name", ["iris-clustering", "movie-explorer", "nba-scoring", "wealth-of-nations"] ) -def test_apps(needle, myselenium, base_url, nb_name): +def test_apps(needle, myselenium, nb_name): target_url = "{0}/voila/render/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) @@ -54,7 +58,7 @@ def test_apps(needle, myselenium, base_url, nb_name): @pytest.mark.parametrize("nb_name", ["classes-colors", "custom-css"]) -def test_customize(needle, myselenium, base_url, nb_name): +def test_customize(needle, myselenium, nb_name): target_url = "{0}/voila/render/customize/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) @@ -66,7 +70,7 @@ def test_customize(needle, myselenium, base_url, nb_name): @pytest.mark.parametrize("nb_name", ["data-types"]) -def test_demos(needle, myselenium, base_url, nb_name): +def test_demos(needle, myselenium, nb_name): target_url = "{0}/voila/render/demos/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) @@ -80,7 +84,7 @@ def test_demos(needle, myselenium, base_url, nb_name): @pytest.mark.parametrize( "nb_name", ["one-plot", "two-columns", "two-plots", "two-rows"] ) -def test_getting_started(needle, myselenium, base_url, nb_name): +def test_getting_started(needle, myselenium, nb_name): target_url = "{0}/voila/render/getting-started/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) @@ -94,7 +98,7 @@ def test_getting_started(needle, myselenium, base_url, nb_name): @pytest.mark.parametrize( "nb_name", ["linked", "matplotlib", "multiplier", "widget-gallery"] ) -def test_illusionist(needle, myselenium, base_url, nb_name): +def test_illusionist(needle, myselenium, nb_name): target_url = "{0}/voila/render/illusionist/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) @@ -125,7 +129,7 @@ def test_illusionist(needle, myselenium, base_url, nb_name): "sidebar-pages", ], ) -def test_layouts(needle, myselenium, base_url, nb_name): +def test_layouts(needle, myselenium, nb_name): target_url = "{0}/voila/render/layouts/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) @@ -150,7 +154,7 @@ def test_layouts(needle, myselenium, base_url, nb_name): "plotly", ], ) -def test_plots(needle, myselenium, base_url, nb_name): +def test_plots(needle, myselenium, nb_name): target_url = "{0}/voila/render/plots/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) @@ -172,7 +176,7 @@ def test_plots(needle, myselenium, base_url, nb_name): "widgets-sidebar", ], ) -def test_widgets(needle, myselenium, base_url, nb_name): +def test_widgets(needle, myselenium, nb_name): target_url = "{0}/voila/render/widgets/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) diff --git a/python/requirements.txt b/python/requirements.txt index 325587ed..df6b9eb0 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -18,7 +18,7 @@ illusionist>=0.2.0 jupyter-flex>=0.6.4 pytest-html pytest-needle -pytest-base-url +# pytest-base-url pytest-selenium pytest-tornasync From 533e8bab0ae5b599ea2ae9baf68d311f58b4ccbf Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Tue, 17 Nov 2020 11:55:50 -0500 Subject: [PATCH 2/8] Add pytest-base-url back --- Makefile | 12 +++---- python/jupyter_flex/tests/test_examples.py | 42 ++++++++++------------ 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index b213d9af..d6058a11 100644 --- a/Makefile +++ b/Makefile @@ -135,20 +135,20 @@ test-setup: test: test-setup ## Run tests - cd $(CURDIR)/python; PYTEST_BASE_URL=$(PYTEST_BASE_URL) pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ - --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots --needle-output-dir test-results/screenshots \ + cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ + --base-url $(PYTEST_BASE_URL) --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots --needle-output-dir test-results/screenshots \ -k $(PYTEST_K) -m $(TEST_MARKERS) --html=test-results/report.html --self-contained-html test-all: test-setup ## Run all tests - cd $(CURDIR)/python; PYTEST_BASE_URL=$(PYTEST_BASE_URL) pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ - --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots --needle-output-dir test-results/screenshots \ + cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ + --base-url $(PYTEST_BASE_URL) --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots --needle-output-dir test-results/screenshots \ -k $(PYTEST_K) --html=test-results/report.html --self-contained-html test-baselines: ## Create test baselines - cd $(CURDIR)/python; PYTEST_BASE_URL=$(PYTEST_BASE_URL) pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ - --needle-save-baseline --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots \ + cd $(CURDIR)/python; pytest --driver Remote --host $(SELENIUM_HUB_HOST) --selenium-port $(SELENIUM_HUB_PORT) --capability browserName chrome \ + --base-url $(PYTEST_BASE_URL) --needle-save-baseline --needle-baseline-dir $(CURDIR)/docs/assets/img/screenshots \ -s -k $(PYTEST_K) diff --git a/python/jupyter_flex/tests/test_examples.py b/python/jupyter_flex/tests/test_examples.py index 1acb2150..52a2eb90 100644 --- a/python/jupyter_flex/tests/test_examples.py +++ b/python/jupyter_flex/tests/test_examples.py @@ -1,11 +1,9 @@ -import os import time import pytest pytestmark = [pytest.mark.nondestructive] -base_url = os.environ.get("PYTEST_BASE_URL", "http://localhost:8866") @pytest.fixture @@ -14,7 +12,7 @@ def myselenium(selenium): return selenium -def test_example_site(needle, myselenium): +def test_example_site(needle, myselenium, base_url): target_url = "http://example.com/" needle.driver.get(target_url) @@ -30,13 +28,11 @@ def test_example_site(needle, myselenium): ("404-voila", "voila/render/fake-page-404"), ], ) -def test_voila(needle, myselenium, name, path): +def test_voila(needle, myselenium, base_url, name, path): target_url = "{0}/{1}".format(base_url, path) needle.driver.get(target_url) - # Wait for page components to render - import os - + # Wait for dashboard to render time.sleep(2) # Take an element screen diff @@ -46,11 +42,11 @@ def test_voila(needle, myselenium, name, path): @pytest.mark.parametrize( "nb_name", ["iris-clustering", "movie-explorer", "nba-scoring", "wealth-of-nations"] ) -def test_apps(needle, myselenium, nb_name): +def test_apps(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(10) # Take an element screen diff @@ -58,11 +54,11 @@ def test_apps(needle, myselenium, nb_name): @pytest.mark.parametrize("nb_name", ["classes-colors", "custom-css"]) -def test_customize(needle, myselenium, nb_name): +def test_customize(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/customize/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -70,11 +66,11 @@ def test_customize(needle, myselenium, nb_name): @pytest.mark.parametrize("nb_name", ["data-types"]) -def test_demos(needle, myselenium, nb_name): +def test_demos(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/demos/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -84,11 +80,11 @@ def test_demos(needle, myselenium, nb_name): @pytest.mark.parametrize( "nb_name", ["one-plot", "two-columns", "two-plots", "two-rows"] ) -def test_getting_started(needle, myselenium, nb_name): +def test_getting_started(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/getting-started/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -98,11 +94,11 @@ def test_getting_started(needle, myselenium, nb_name): @pytest.mark.parametrize( "nb_name", ["linked", "matplotlib", "multiplier", "widget-gallery"] ) -def test_illusionist(needle, myselenium, nb_name): +def test_illusionist(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/illusionist/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -129,11 +125,11 @@ def test_illusionist(needle, myselenium, nb_name): "sidebar-pages", ], ) -def test_layouts(needle, myselenium, nb_name): +def test_layouts(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/layouts/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -154,11 +150,11 @@ def test_layouts(needle, myselenium, nb_name): "plotly", ], ) -def test_plots(needle, myselenium, nb_name): +def test_plots(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/plots/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(5) # Take an element screen diff @@ -176,11 +172,11 @@ def test_plots(needle, myselenium, nb_name): "widgets-sidebar", ], ) -def test_widgets(needle, myselenium, nb_name): +def test_widgets(needle, myselenium, base_url, nb_name): target_url = "{0}/voila/render/widgets/{1}.ipynb".format(base_url, nb_name) needle.driver.get(target_url) - # Wait for dashboard components to render + # Wait for dashboard to render time.sleep(10) # Take an element screen diff From 50db7d823baf943c289f79cd3e0e3a438832a33b Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Tue, 17 Nov 2020 11:56:25 -0500 Subject: [PATCH 3/8] Add pytest-base-url back --- environment.yml | 2 +- python/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index a50b4860..b4cd8e02 100644 --- a/environment.yml +++ b/environment.yml @@ -26,7 +26,7 @@ dependencies: - jupyter-flex>=0.6.4 - pytest-html - pytest-needle - # - pytest-base-url + - pytest-base-url - pytest-selenium - pytest-tornasync diff --git a/python/requirements.txt b/python/requirements.txt index df6b9eb0..325587ed 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -18,7 +18,7 @@ illusionist>=0.2.0 jupyter-flex>=0.6.4 pytest-html pytest-needle -# pytest-base-url +pytest-base-url pytest-selenium pytest-tornasync From e0a102dd964fea170c7f01ff8c7fa5baa4d32b3c Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Tue, 17 Nov 2020 12:11:44 -0500 Subject: [PATCH 4/8] Cleanup --- python/setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/python/setup.cfg b/python/setup.cfg index 119768cb..c558cb78 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -8,7 +8,6 @@ exclude = .git,dist,build,env,venv,*.egg*,node_modules [tool:pytest] norecursedirs = .git,dist,build,env,venv -strict = true addopts = jupyter_flex/tests --cov=jupyter_flex --cov-report term-missing markers = selenium: requires selenium (deselect with '-m "not selenium"') From 5e47071ed6eb5a0a33d91993c27aba09dad9e66b Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Sat, 5 Dec 2020 10:33:51 -0500 Subject: [PATCH 5/8] Trying latest release of jupyter_server --- python/requirements-package.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/python/requirements-package.txt b/python/requirements-package.txt index 0226d31c..538efdf8 100644 --- a/python/requirements-package.txt +++ b/python/requirements-package.txt @@ -1,3 +1,4 @@ voila>=0.2.0,<0.3 nbconvert>=6.0.7,<7 nbclient>=0.4.0 +jupyter_server>=1.0.8 From 9ea9f51aab7fc356c569d26e001d1c201554e109 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Mon, 21 Dec 2020 11:25:40 -0500 Subject: [PATCH 6/8] update --- python/requirements-package.txt | 2 +- python/setup.cfg | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/python/requirements-package.txt b/python/requirements-package.txt index 538efdf8..c69b56c0 100644 --- a/python/requirements-package.txt +++ b/python/requirements-package.txt @@ -1,4 +1,4 @@ voila>=0.2.0,<0.3 nbconvert>=6.0.7,<7 nbclient>=0.4.0 -jupyter_server>=1.0.8 +jupyter_server>=1.1.0 diff --git a/python/setup.cfg b/python/setup.cfg index c558cb78..a2b551a1 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -11,3 +11,6 @@ norecursedirs = .git,dist,build,env,venv addopts = jupyter_flex/tests --cov=jupyter_flex --cov-report term-missing markers = selenium: requires selenium (deselect with '-m "not selenium"') +pytest_plugin = [ + "jupyter_server.pytest_plugin", +] From 5badb04e1fec9d84cfd0af1924c0e36aee6384fe Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Mon, 21 Dec 2020 11:48:43 -0500 Subject: [PATCH 7/8] Pytest pyproject --- python/pyproject.toml | 9 +++++++++ python/setup.cfg | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index 3751cd91..84e9a888 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,15 @@ [build-system] requires = ["setuptools>=42", "setuptools_scm[toml]>=3.4", "wheel"] +[tool.pytest.ini_options] +norecursedirs = ".git,dist,build,env,venv" +addopts = "jupyter_flex/tests --cov=jupyter_flex --cov-report term-missing" +markers = [ + "selenium: requires selenium (deselect with '-m \"not selenium\"')" +] +pytest_plugin = ["jupyter_server.pytest_plugin"] + + [tool.coverage.run] parallel = true branch = true diff --git a/python/setup.cfg b/python/setup.cfg index a2b551a1..977e821e 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -5,12 +5,3 @@ ignore = E203, E501, W503 select = C,E,F,W,B,B950 paths = .,jupyter_flex exclude = .git,dist,build,env,venv,*.egg*,node_modules - -[tool:pytest] -norecursedirs = .git,dist,build,env,venv -addopts = jupyter_flex/tests --cov=jupyter_flex --cov-report term-missing -markers = - selenium: requires selenium (deselect with '-m "not selenium"') -pytest_plugin = [ - "jupyter_server.pytest_plugin", -] From 58005cec6ecd11754678fb7754fa1547fd0949ff Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Mon, 21 Dec 2020 12:01:51 -0500 Subject: [PATCH 8/8] Deps --- environment.yml | 1 + python/requirements.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/environment.yml b/environment.yml index b4cd8e02..1699796e 100644 --- a/environment.yml +++ b/environment.yml @@ -22,6 +22,7 @@ dependencies: - voila>=0.2.0,<0.3 - nbconvert>=6.0.0,<7 - nbclient>=0.4.0 + - jupyter_server>=1.1.0 - illusionist>=0.2.0 - jupyter-flex>=0.6.4 - pytest-html diff --git a/python/requirements.txt b/python/requirements.txt index 325587ed..4c0760c2 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -14,6 +14,7 @@ pytest-cov voila>=0.2.0,<0.3 nbconvert>=6.0.0,<7 nbclient>=0.4.0 +jupyter_server>=1.1.0 illusionist>=0.2.0 jupyter-flex>=0.6.4 pytest-html