def test_read_file(self): tn = tempfile.mktemp() with open(tn, 'w') as f: f.write(TEST_CONFIG) d = configuration.read_configuration(tn) eq_(d['outfile'], '/tmp/spam') eq_(d['format'], ['pretty', 'tag-counter']) eq_(d['tags'], ['@foo,~@bar', '@zap']) eq_(d['stdout_capture'], False) ok_('bogus' not in d)
def test_read_file(self): # XXX-JE-ORIG, DEPRECATED: mktemp() with named_temporary_file() as f: f.write(TEST_CONFIG) f.close() d = configuration.read_configuration(f.name) eq_(d['outfile'], '/tmp/spam') eq_(d['format'], ['pretty', 'tag-counter']) eq_(d['tags'], ['@foo,~@bar', '@zap']) eq_(d['stdout_capture'], False) ok_('bogus' not in d)
def test_read_file(self): tn = tempfile.mktemp() with open(tn, 'w') as f: f.write(TEST_CONFIG) d = configuration.read_configuration(tn) eq_(d['outfile'], '/tmp/spam') eq_(d['paths'], [ '/absolute/path', os.path.normpath(os.path.join(os.path.dirname(tn), 'relative/path')), ]) eq_(d['format'], ['pretty', 'tag-counter']) eq_(d['tags'], ['@foo,~@bar', '@zap']) eq_(d['stdout_capture'], False) ok_('bogus' not in d)
def test_read_file(self): tn = tempfile.mktemp() tndir = os.path.dirname(tn) with open(tn, 'w') as f: f.write(TEST_CONFIG) d = configuration.read_configuration(tn) eq_(d['outfiles'], [ os.path.normpath('/absolute/path1'), os.path.normpath(os.path.join(tndir, 'relative/path2')), ]) eq_(d['paths'], [ os.path.normpath('/absolute/path3'), # -- WINDOWS-REQUIRES: normpath os.path.normpath(os.path.join(tndir, 'relative/path4')), ]) eq_(d['format'], ['pretty', 'tag-counter']) eq_(d['tags'], ['@foo,~@bar', '@zap']) eq_(d['stdout_capture'], False) ok_('bogus' not in d)
def test_read_file(self): tn = tempfile.mktemp() tndir = os.path.dirname(tn) with open(tn, "w") as f: f.write(TEST_CONFIG) # -- WINDOWS-REQUIRES: normpath d = configuration.read_configuration(tn) eq_(d["outfiles"], [ os.path.normpath(ROOTDIR_PREFIX + "/absolute/path1"), os.path.normpath(os.path.join(tndir, "relative/path2")), ]) eq_(d["paths"], [ os.path.normpath(ROOTDIR_PREFIX + "/absolute/path3"), os.path.normpath(os.path.join(tndir, "relative/path4")), ]) eq_(d["format"], ["pretty", "tag-counter"]) eq_(d["tags"], ["@foo,~@bar", "@zap"]) eq_(d["stdout_capture"], False) ok_("bogus" not in d) eq_(d["userdata"], {"foo": "bar", "answer": "42"})