コード例 #1
0
ファイル: config_test.py プロジェクト: tek/pytek
 def autoload(self):
     Config.allow_files = True
     sys.path.insert(0, fixture_path('config'))
     Config.setup('mod1', 'mod3')
     Config['sec1'].key1.should.equal('success')
     Config['sec2'].key1.should.equal('val1')
     invalid_section = lambda: Config['sec9']
     invalid_section.when.called_with().should.throw(NoSuchSectionError)
     invalid_option = lambda: Config['sec1'].inval
     invalid_option.when.called_with().should.throw(NoSuchOptionError)
コード例 #2
0
ファイル: config_test.py プロジェクト: tek/pytek
 def write(self):
     outfile = temp_file('config', 'outfile.conf')
     write_pkg_config(fixture_path('config'), outfile, 'mod2')
     with open(outfile) as _file:
         lines = _file.readlines()
         lines.should.equal(['[sec2]\n', '# key1 = val0\n', '\n'])