diff --git a/tests/test_api.py b/tests/test_api.py index ceb7ef4..9aecf38 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -52,11 +52,13 @@ def test_bug_196(): def test_valid_tests(): valid_dir = "toml-test/tests/valid/" - for f in os.listdir(valid_dir): - if not f.endswith("toml"): - continue - with open(os.path.join(valid_dir, f)) as fh: - toml.dumps(toml.load(fh)) + for path, sub_dirs, files in os.walk(valid_dir): + for name in files: + f = os.path.join(path, name) + if not f.endswith("toml"): + continue + with open(f) as fh: + toml.dumps(toml.load(fh)) def test_circular_ref(): @@ -168,12 +170,14 @@ def test_decimal(): def test_invalid_tests(): invalid_dir = "toml-test/tests/invalid/" - for f in os.listdir(invalid_dir): - if not f.endswith("toml"): - continue - with pytest.raises(toml.TomlDecodeError): - with open(os.path.join(invalid_dir, f)) as fh: - toml.load(fh) + for path, sub_dirs, files in os.walk(invalid_dir): + for name in files: + f = os.path.join(path, name) + if not f.endswith("toml"): + continue + with pytest.raises(toml.TomlDecodeError): + with open(f) as fh: + toml.load(fh) def test_exceptions():