@@ -33,3 +33,30 @@ def test_matplotlib(container):
3333 cmd = running_container .exec_run (command )
3434 assert cmd .exit_code == 0 , f"Command { command } failed"
3535 LOGGER .debug (cmd .output .decode ("utf-8" ))
36+
37+
38+ def test_matplotlib_fonts (container ):
39+ """Test matplotlib latex fonts, which depend on the cm-super package"""
40+ host_data_dir = os .path .join (os .path .dirname (os .path .realpath (__file__ )),
41+ "data" )
42+ cont_data_dir = "/home/jovyan/data"
43+ test_file = "matplotlib_fonts_1.py"
44+ output_dir = "/tmp"
45+ LOGGER .info (f"Test cm-super latex labels in matplotlib ..." )
46+ command = "sleep infinity"
47+ running_container = container .run (
48+ volumes = {host_data_dir : {"bind" : cont_data_dir , "mode" : "ro" }},
49+ tty = True ,
50+ command = ["start.sh" , "bash" , "-c" , command ],
51+ )
52+ command = f"python { cont_data_dir } /{ test_file } "
53+ cmd = running_container .exec_run (command )
54+ assert cmd .exit_code == 0 , f"Command { command } failed"
55+ LOGGER .debug (cmd .output .decode ("utf-8" ))
56+ # Checking if the file is generated
57+ # https://stackoverflow.com/a/15895594/4413446
58+ expected_file = f"{ output_dir } /test_fonts.png"
59+ command = f"test -s { expected_file } "
60+ cmd = running_container .exec_run (command )
61+ assert cmd .exit_code == 0 , f"Command { command } failed"
62+ LOGGER .debug (cmd .output .decode ("utf-8" ))
0 commit comments