From ce15a29157f657019c7b9500895260b4d6e9a553 Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Mon, 20 Aug 2018 20:10:32 +0300 Subject: [PATCH] Fix matplotlib tests --- test/conftest.py | 8 ++++---- test/test_matplotlib.py | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index 34dc54799..ec30d02c5 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -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: diff --git a/test/test_matplotlib.py b/test/test_matplotlib.py index 9530d7670..65899411d 100644 --- a/test/test_matplotlib.py +++ b/test/test_matplotlib.py @@ -1,12 +1,15 @@ 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("