def cmd(tool_opts, open_browser, tool, source): with tempdir() as dirpath: server = Server() source_abspath = os.path.abspath(source) command_instance = get_command(tool, source_abspath, dirpath, tool_opts) command_str = str(command_instance) sh = shell(command_str, cwd=dirpath) sh() server.watch(source, sh) image_filepath = command_instance.destination image_filename = os.path.basename(image_filepath) page = render(image_filename) deploy(dirpath, page) server.serve(root=dirpath, open_url_delay=open_browser)
def test(self): imgpath = 'sample.png' page = render(imgpath) assert page.find(imgpath) != -1