Commit ce15a291 authored by Roman Yurchak's avatar Roman Yurchak

Fix matplotlib tests

parent 9245f6f2
......@@ -118,8 +118,8 @@ if pytest is not None:
@pytest.fixture(params=['firefox', 'chrome'], scope='module')
def _selenium_cached(request):
# intermediary cached selenium instance, this is a copy
# of the selenium_standalone to avoid fixture scope issues
# Cached selenium instance. This is a copy-paste of
# selenium_standalone to avoid fixture scope issues
if request.param == 'firefox':
cls = FirefoxWrapper
elif request.param == 'chrome':
......@@ -132,9 +132,9 @@ if pytest is not None:
@pytest.fixture
def selenium(_selenium_cached):
# this is selenium instance cached at the module level
# selenium instance cached at the module level
try:
# for each test run, we clean selenium logs
# clean selenium logs for each test run
_selenium_cached.driver.execute_script("window.logs = []")
yield _selenium_cached
finally:
......
def test_matplotlib(selenium):
selenium.load_package("matplotlib")
selenium.run("from matplotlib import pyplot as plt")
selenium.run("plt.figure()")
selenium.run("x = plt.plot([1,2,3])")
selenium.run("plt.destroy_all()")
def test_svg(selenium):
selenium.load_package("matplotlib")
selenium.run("from matplotlib import pyplot as plt")
selenium.run("plt.figure()")
selenium.run("x = plt.plot([1,2,3])")
selenium.run("import io")
selenium.run("fd = io.BytesIO()")
......@@ -14,3 +17,4 @@ def test_svg(selenium):
content = selenium.run("fd.getvalue().decode('utf8')")
assert len(content) == 15752
assert content.startswith("<?xml")
selenium.run("plt.destroy_all()")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment