comparison tests/mock.py @ 339:64acfb58e023

Cleanup import and code.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 28 Aug 2015 23:12:22 -0700
parents 03e3e793fa22
children c78eaebced8b
comparison
equal deleted inserted replaced
338:f7a741bc5770 339:64acfb58e023
1 import os 1 import os
2 import os.path 2 import os.path
3 import types
4 import codecs 3 import codecs
5 import logging 4 import logging
6 import io 5 import io
7 from collections import deque 6 from collections import deque
8 from contextlib import closing 7 from contextlib import closing
55 def getPageUpdater(self): 54 def getPageUpdater(self):
56 return lambda wiki, url: wiki.update(url, cache_ext_data=True) 55 return lambda wiki, url: wiki.update(url, cache_ext_data=True)
57 56
58 def _loadConfig(self): 57 def _loadConfig(self):
59 default_config_path = os.path.join( 58 default_config_path = os.path.join(
60 os.path.dirname(__file__), '..', 'wikked', 'resources', 'defaults.cfg') 59 os.path.dirname(__file__), '..',
60 'wikked', 'resources', 'defaults.cfg')
61 61
62 config = SafeConfigParser() 62 config = SafeConfigParser()
63 config.readfp(open(default_config_path)) 63 config.readfp(open(default_config_path))
64 config.set('wiki', 'root', '/fake/root') 64 config.set('wiki', 'root', '/fake/root')
65 if self.config_text: 65 if self.config_text:
157 cur = cur[b] 157 cur = cur[b]
158 else: 158 else:
159 cur[b] = v 159 cur[b] = v
160 return nested 160 return nested
161 161
162
163 @staticmethod 162 @staticmethod
164 def save_structure(path, structure): 163 def save_structure(path, structure):
165 if not os.path.isdir(path): 164 if not os.path.isdir(path):
166 os.makedirs(path) 165 os.makedirs(path)
167 for node in structure: 166 for node in structure: