<s> import os <EOL> import pytest <EOL> from khal . khalendar import CalendarCollection <EOL> from vdirsyncer . storage . filesystem import FilesystemStorage <EOL> from . aux import locale , example_cals , cal1 <EOL> @ pytest . fixture <EOL> def coll_vdirs ( tmpdir ) : <EOL> calendars , vdirs = dict ( ) , dict ( ) <EOL> for name in example_cals : <EOL> path = str ( tmpdir ) + '<STR_LIT:/>' + name <EOL> os . makedirs ( path , mode = <NUM_LIT> ) <EOL> calendars [ name ] = { '<STR_LIT:name>' : name , '<STR_LIT:path>' : path , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , '<STR_LIT>' : True } <EOL> vdirs [ name ] = FilesystemStorage ( path , '<STR_LIT>' ) <EOL> coll = CalendarCollection ( calendars = calendars , dbpath = '<STR_LIT>' , locale = locale ) <EOL> coll . default_calendar_name = cal1 <EOL> return coll , vdirs <EOL> @ pytest . fixture ( autouse = True ) <EOL> def never_echo_bytes ( monkeypatch ) : <EOL> '''<STR_LIT>''' <EOL> from click import echo as old_echo <EOL> def echo ( msg = None , * a , ** kw ) : <EOL> assert not isinstance ( msg , bytes ) <EOL> return old_echo ( msg , * a , ** kw ) <EOL> monkeypatch . setattr ( '<STR_LIT>' , echo ) <EOL> class Result : <EOL> @ staticmethod <EOL> def undo ( ) : <EOL> monkeypatch . setattr ( '<STR_LIT>' , old_echo ) <EOL> return Result </s>
