Beispiel #1
0
 def test_multiple_files(self, datadir):
     ini_filename = os.path.join(datadir, "config_test.ini")
     ini_filename_original = os.path.join(datadir, "config_test_original.ini")
     cie = ConfigIniEnv([ini_filename, ini_filename_original])
     # Only the first found file is loaded, so foo_original does not exist
     assert cie.get("foo_original") == NO_VALUE
     cie = ConfigIniEnv([ini_filename_original])
     # ... but it is there if only the original is loaded (safety check)
     assert cie.get("foo_original") == "original"
Beispiel #2
0
 def test_multiple_files(self, datadir):
     ini_filename = os.path.join(datadir, 'config_test.ini')
     ini_filename_original = os.path.join(datadir, 'config_test_original.ini')
     cie = ConfigIniEnv([ini_filename, ini_filename_original])
     # Only the first found file is loaded, so foo_original does not exist
     assert cie.get('foo_original') == NO_VALUE
     cie = ConfigIniEnv([ini_filename_original])
     # ... but it is there if only the original is loaded (safety check)
     assert cie.get('foo_original') == 'original'
Beispiel #3
0
    def test_basic_usage(self, datadir):
        ini_filename = os.path.join(datadir, 'config_test.ini')
        cie = ConfigIniEnv([ini_filename])
        assert cie.get('foo') == 'bar'
        assert cie.get('FOO') == 'bar'
        assert cie.get('foo', namespace='nsbaz') == 'bat'
        assert cie.get('foo', namespace=['nsbaz']) == 'bat'
        assert cie.get('foo', namespace=['nsbaz', 'nsbaz2']) == 'bat2'

        cie = ConfigIniEnv(['/a/b/c/bogus/filename'])
        assert cie.get('foo') == NO_VALUE
Beispiel #4
0
    def test_basic_usage(self, datadir):
        ini_filename = os.path.join(datadir, "config_test.ini")
        cie = ConfigIniEnv([ini_filename])
        assert cie.get("foo") == "bar"
        assert cie.get("FOO") == "bar"
        assert cie.get("foo", namespace="nsbaz") == "bat"
        assert cie.get("foo", namespace=["nsbaz"]) == "bat"
        assert cie.get("foo", namespace=["nsbaz", "nsbaz2"]) == "bat2"

        cie = ConfigIniEnv(["/a/b/c/bogus/filename"])
        assert cie.get("foo") == NO_VALUE
Beispiel #5
0
    def test_basic_usage(self, datadir):
        ini_filename = os.path.join(datadir, 'config_test.ini')
        cie = ConfigIniEnv([ini_filename])
        assert cie.get('foo') == 'bar'
        assert cie.get('FOO') == 'bar'
        assert cie.get('foo', namespace='nsbaz') == 'bat'
        assert cie.get('foo', namespace=['nsbaz']) == 'bat'
        assert cie.get('foo', namespace=['nsbaz', 'nsbaz2']) == 'bat2'

        cie = ConfigIniEnv(['/a/b/c/bogus/filename'])
        assert cie.get('foo') == NO_VALUE
Beispiel #6
0
 def test_does_not_parse_lists(self, datadir):
     ini_filename = os.path.join(datadir, 'config_test.ini')
     cie = ConfigIniEnv([ini_filename])
     assert cie.get('bar') == 'test1,test2'
Beispiel #7
0
 def test_does_not_parse_lists(self, datadir):
     ini_filename = os.path.join(datadir, "config_test.ini")
     cie = ConfigIniEnv([ini_filename])
     assert cie.get("bar") == "test1,test2"
Beispiel #8
0
 def test_does_not_parse_lists(self, datadir):
     ini_filename = os.path.join(datadir, 'config_test.ini')
     cie = ConfigIniEnv([ini_filename])
     assert cie.get('bar') == 'test1,test2'