def testInclude(self):
        fd, tempPath = tempfile.mkstemp(suffix='.cfg')

        def unlinkTemp(path):
            try:
                os.unlink(path)
            except:
                pass

        atexit.register(unlinkTemp, tempPath)
        fp = os.fdopen(fd, "w")
        print >> fp, '[section3]\nbaz = somevalue\n'
        fp.close()

        s = '%s\n\n%%include "%s"\n' % (CONFIG2, tempPath)

        os.environ['SOME_ENV_VAR'] = 'test_test_test'
        config = Configuration()
        config.readfp(StringIO(s))
        unlinkTemp(tempPath)
        assert config.has_section('section1')
        assert config.has_section('section2')
        assert config.has_section('section3')
        assert not config.has_section('foo')
        assert not config.has_section('bar')
        assert not config.has_section('bar2')
        assert config.has_option('section1', 'foo')
        assert config.has_option('section1', 'bar')
        assert not config.has_option('section1', 'bar2')
        assert config.has_option('section2', 'foo')
        assert config.has_option('section2', 'bar')
        assert config.has_option('section3', 'baz')
        assert config.get('section1', 'foo') == 'bar'
        assert config.get('section1', 'bar') == 'bar'
        assert config.get('section2', 'foo') == 'bar'
        assert config.get('section2', 'bar') == os.environ['SOME_ENV_VAR']
        assert config.get('section3', 'baz') == 'somevalue'
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/grizzled/grizzled/test/config/TestConfiguration.py/TestParser.testInclude/original