Basic tests (#355)

* Added microsoft channel and playwright as dependency

* Added test-setup to run

* Basic tests for each example in examples/index.html

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_webgl_raycaster_index.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_folium.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_folium.py

* Update test_folium.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_bokeh.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Whitelisting assertion statements in test files

* Updated bare execept statements with ImportError

* Flake8 compliance

* Updated  message

* Removed 'make test-setup'

* Removed @echo from make test

* Uncommented Toga test

* Removed __test_all__.py file

* Removing unnecessary files

* Removed individual test files

* conftest.py with all data for running tests

* Consolidated test file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed pre-commit flake8 issues

* flake8 issue

* add playwright installation to setup

* Testing parameterization and webserver to serve examples locally

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Flake8 compliance

* More flake8

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Michael Verhulst <michael@terminallabs.com>
Co-authored-by: Fabio Pliger <fabio.pliger@gmail.com>
This commit is contained in:
cleonard
2022-05-18 13:08:15 -05:00
committed by GitHub
parent 0d946f853f
commit 59fc667651
5 changed files with 250 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
"""All data required for testing examples"""
import os
import threading
from http.server import HTTPServer as SuperHTTPServer
from http.server import SimpleHTTPRequestHandler
from pathlib import Path
import pytest
my_path = Path.cwd() / "examples"
os.chdir(my_path)
class HTTPServer(SuperHTTPServer):
"""
Class for wrapper to run SimpleHTTPServer on Thread.
Ctrl +Only Thread remains dead when terminated with C.
Keyboard Interrupt passes.
"""
def run(self):
try:
self.serve_forever()
except KeyboardInterrupt:
pass
finally:
self.server_close()
@pytest.fixture(scope="session")
def http_server():
host, port = "127.0.0.1", 8080
base_url = f"http://{host}:{port}"
# serve_Run forever under thread
server = HTTPServer((host, port), SimpleHTTPRequestHandler)
thread = threading.Thread(None, server.run)
thread.start()
yield base_url # Transition to test here
# End thread
server.shutdown()
thread.join()