1import pytest 2 3from setuptools.glob import glob 4 5from .files import build_files 6 7 8@pytest.mark.parametrize('tree, pattern, matches', ( 9 ('', b'', []), 10 ('', '', []), 11 (''' 12 appveyor.yml 13 CHANGES.rst 14 LICENSE 15 MANIFEST.in 16 pyproject.toml 17 README.rst 18 setup.cfg 19 setup.py 20 ''', '*.rst', ('CHANGES.rst', 'README.rst')), 21 (''' 22 appveyor.yml 23 CHANGES.rst 24 LICENSE 25 MANIFEST.in 26 pyproject.toml 27 README.rst 28 setup.cfg 29 setup.py 30 ''', b'*.rst', (b'CHANGES.rst', b'README.rst')), 31)) 32def test_glob(monkeypatch, tmpdir, tree, pattern, matches): 33 monkeypatch.chdir(tmpdir) 34 build_files({name: '' for name in tree.split()}) 35 assert list(sorted(glob(pattern))) == list(sorted(matches)) 36