Mercurial > wikked
comparison tests/mock.py @ 497:36c3e9b1d1e3
cm: Upgrade all dependencies and fix deprecation issues.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 06 Jun 2020 22:24:38 -0700 |
parents | 2027ab79f006 |
children |
comparison
equal
deleted
inserted
replaced
492:eacacee352f7 | 497:36c3e9b1d1e3 |
---|---|
3 import codecs | 3 import codecs |
4 import logging | 4 import logging |
5 import io | 5 import io |
6 from collections import deque | 6 from collections import deque |
7 from contextlib import closing | 7 from contextlib import closing |
8 from configparser import SafeConfigParser | 8 from configparser import ConfigParser |
9 from wikked.fs import FileSystem | 9 from wikked.fs import FileSystem |
10 from wikked.db.base import Database | 10 from wikked.db.base import Database |
11 from wikked.indexer.base import WikiIndex | 11 from wikked.indexer.base import WikiIndex |
12 from wikked.scm.base import SourceControl | 12 from wikked.scm.base import SourceControl |
13 from wikked.wiki import WikiParameters, passthrough_formatter | 13 from wikked.wiki import WikiParameters, passthrough_formatter |
57 def _loadConfig(self): | 57 def _loadConfig(self): |
58 default_config_path = os.path.join( | 58 default_config_path = os.path.join( |
59 os.path.dirname(__file__), '..', | 59 os.path.dirname(__file__), '..', |
60 'wikked', 'resources', 'defaults.cfg') | 60 'wikked', 'resources', 'defaults.cfg') |
61 | 61 |
62 config = SafeConfigParser() | 62 config = ConfigParser() |
63 config.readfp(open(default_config_path)) | 63 config.read_file(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: |
66 with closing(io.StringIO(self.config_text)) as conf: | 66 with closing(io.StringIO(self.config_text)) as conf: |
67 config.readfp(conf) | 67 config.read_file(conf) |
68 | 68 |
69 return config | 69 return config |
70 | 70 |
71 | 71 |
72 def mock_os_walk(root_dir, root_node): | 72 def mock_os_walk(root_dir, root_node): |