11"""
22@brief test log(time=1s)
3- @author Xavier Dupre
43"""
5-
64import sys
75import os
86import unittest
97import warnings
108import pandas
11-
12- from pyquickhelper .loghelper .flog import fLOG
139from pyquickhelper .helpgen .sphinx_main_helper import produce_code_graph_changes
14- from pyquickhelper .pycode import fix_tkinter_issues_virtualenv
10+ from pyquickhelper .pycode import fix_tkinter_issues_virtualenv , skipif_appveyor
1511
1612
1713class TestGraphChanges (unittest .TestCase ):
1814
15+ @skipif_appveyor ("Message: 'generated new fontManager'" )
1916 def test_graph_changes (self ):
20- fLOG (
21- __file__ ,
22- self ._testMethodName ,
23- OutputPrint = __name__ == "__main__" )
24-
25- abc = fix_tkinter_issues_virtualenv ()
26- for a in abc :
27- fLOG (a )
28-
17+ fix_tkinter_issues_virtualenv ()
2918 path = os .path .abspath (os .path .split (__file__ )[0 ])
3019 data = os .path .join (path , "data" , "changes.txt" )
3120 df = pandas .read_csv (data , sep = "\t " )
32- fLOG (type (df .loc [0 , "date" ]), df .loc [0 , "date" ])
3321 code = produce_code_graph_changes (df )
34- fLOG (code )
3522
3623 enabled = True
3724 if enabled :
@@ -50,9 +37,8 @@ def test_graph_changes(self):
5037 '2015-w08' , '2015-w09' , '2015-w10' , '2015-w11' , '2015-w12' , '2015-w13' , '2015-w14' , '2015-w15' ,
5138 '2015-w16' , '2015-w17' , '2015-w18' , '2015-w19' , '2015-w20' ]
5239 plt .close ('all' )
53- plt .style .use ('ggplot' )
5440 with warnings .catch_warnings ():
55- warnings .simplefilter ('ignore' , DeprecationWarning )
41+ warnings .simplefilter ('ignore' , ( DeprecationWarning , UserWarning ) )
5642 _ , ax = plt .subplots (nrows = 1 , ncols = 1 , figsize = (10 , 4 ))
5743 ax .bar (x , y )
5844 tig = ax .get_xticks ()
@@ -70,10 +56,11 @@ def test_graph_changes(self):
7056 code = code .replace ("plt.show" , "#plt.show" )
7157
7258 obj = compile (code , "" , "exec" )
73- try :
74- exec (obj , globals (), locals ())
75- except Exception as e :
76- raise Exception (f"unable to run code:\n { code } " ) from e
59+ if sys .platform != "win32" and __name__ != "__main__" :
60+ try :
61+ exec (obj , globals (), locals ())
62+ except Exception as e :
63+ raise AssertionError (f"Unable to run code:\n { code } " ) from e
7764
7865
7966if __name__ == "__main__" :
0 commit comments