From bde1e8fe11daef1098eaa84d38706b3d959e9578 Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Sat, 1 Apr 2017 14:09:21 +0800 Subject: [PATCH] mv IPython to if guard for test --- python/paddle/v2/plot/plot.py | 7 ++++--- python/paddle/v2/plot/tests/run_tests.sh | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/python/paddle/v2/plot/plot.py b/python/paddle/v2/plot/plot.py index d36fc47d8e..a685036970 100644 --- a/python/paddle/v2/plot/plot.py +++ b/python/paddle/v2/plot/plot.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from IPython import display import os @@ -39,7 +38,9 @@ class Ploter(object): self.__disable_plot__ = os.environ.get("DISABLE_PLOT") if not self.__plot_is_disabled__(): import matplotlib.pyplot as plt + from IPython import display self.plt = plt + self.display = display def __plot_is_disabled__(self): return self.__disable_plot__ == "True" @@ -63,8 +64,8 @@ class Ploter(object): titles.append(title) self.plt.plot(data.step, data.value) self.plt.legend(titles, loc='upper left') - display.clear_output(wait=True) - display.display(self.plt.gcf()) + self.display.clear_output(wait=True) + self.display.display(self.plt.gcf()) self.plt.gcf().clear() def reset(self): diff --git a/python/paddle/v2/plot/tests/run_tests.sh b/python/paddle/v2/plot/tests/run_tests.sh index 20514160cd..9c1a4a71ce 100755 --- a/python/paddle/v2/plot/tests/run_tests.sh +++ b/python/paddle/v2/plot/tests/run_tests.sh @@ -21,6 +21,7 @@ popd > /dev/null cd $SCRIPTPATH $1 -m pip install ../../../../../paddle/dist/*.whl +export DISABLE_PLOT="True" test_list="test_ploter.py" export PYTHONPATH=$PWD/../../../../../python/ -- GitLab