1+ from .hugo_doc import HugoDoc
2+
13from PIL import Image
2- from io import StringIO
3- from datetime import datetime
44from slugify import UniqueSlugify
55import os
66
77slugger = UniqueSlugify ()
88
9- from .hugo_doc import HugoDoc
10-
119
1210class DocsMaker (object ):
1311 """A documentation site maker."""
12+
1413 def __init__ (self , section ):
1514 self .section = section
16- self .output_dir = '%s/livingdocs/content/%s' % (os .getcwd (), self .section )
15+ self .output_dir = '%s/livingdocs/content/%s' % (
16+ os .getcwd (), self .section )
1717
1818 def fix_filename (self , s ):
1919 parts = s .split ('/' )
@@ -38,7 +38,8 @@ def start_feature(self, context, feature):
3838 def end_feature (self , context , feature ):
3939 # calculate the number of scenarios
4040 self .doc .meta ['num_scenarios' ] = len (feature .scenarios )
41- self .doc .meta ['num_scenarios_passing' ] = len ([s for s in feature .scenarios if s .status == 'passed' ])
41+ self .doc .meta ['num_scenarios_passing' ] = len (
42+ [s for s in feature .scenarios if s .status == 'passed' ])
4243
4344 # write an index.md file for all the info we've accumulated about
4445 # this feature
@@ -69,19 +70,22 @@ def end_step(self, context, step):
6970
7071 # get the screenshot
7172 try :
72- context .browser .driver .get_screenshot_as_file ('%s/%s/%s' % (self .output_dir , self .doc .path , shot_name ))
73+ context .browser .driver .get_screenshot_as_file (
74+ '%s/%s/%s' % (self .output_dir , self .doc .path , shot_name ))
7375 except :
7476 shot_name = None
7577 image_code = 'error capturing'
7678
7779 # make a thumbnail of it
7880 if shot_name :
79- im = Image .open ('%s/%s/%s' % (self .output_dir , self .doc .path , shot_name ))
81+ im = Image .open ('%s/%s/%s' %
82+ (self .output_dir , self .doc .path , shot_name ))
8083 im .thumbnail ((100 , 100 ))
8184 im .save ('%s/%s/%s' % (self .output_dir , self .doc .path , thumb_name ))
8285
83- image_code = '<a href="%s"><img class="img-thumbnail" src="%s" width="100" /></a>' % (shot_name , thumb_name )
86+ image_code = '<a href="%s"><img class="img-thumbnail" src="%s" width="100" /></a>' % (
87+ shot_name , thumb_name )
8488
8589 # write the step information to file
86- self .doc .writeline (u'%s %s | %s | %0.2f | %s' % (step . keyword , step . name , step . status , step . duration , image_code ))
87-
90+ self .doc .writeline (u'%s %s | %s | %0.2f | %s' % (
91+ step . keyword , step . name , step . status , step . duration , image_code ))
0 commit comments