Example #1
0
    def test_it_should_filter_extensions(self, examples):
        examples.clear()
        examples.get_many(FILES)
        expected_contents = parse(examples.get(FILES[0]))  # toml file

        config = load_paths([str(examples.tmpdir)],
                            extension='toml',
                            force_extension=True)

        # Only reads the toml file
        assert_that(config, is_(expected_contents))
Example #2
0
 def test_it_should_fail_with_invalid_extensions(self, name, examples):
     with pytest.raises(Exception):
         parse(examples.get(name))
Example #3
0
 def test_it_should_fail_with_missing_files(self):
     with pytest.raises(Exception):
         parse('/path/to/nowhere.json')
Example #4
0
    def test_it_should_load_for_given_format(self, name, format, examples):
        config = parse(examples.get(name), format)

        assert_that(config, has_entry('section', has_key('string')))
Example #5
0
    def test_it_loads_strings_as_unicode(self, name, examples):
        config = parse(examples.get(name))

        assert_that(config,
                    has_entry('section', has_entry('unicode', is_(u'💩'))))
Example #6
0
    def test_it_should_detect_format_from_extension(self, name, examples):
        config = parse(examples.get(name))

        assert_that(config, has_entry('section', has_key('string')))