Debian Codegraph @

tests/test_tomlify.py

raw
1 from pathlib import Path
2 try:
3 import tomllib
4 except ImportError:
5 import tomli as tomllib
6 from testpath import assert_isfile
7
8 from flit import tomlify
9
10 samples_dir = Path(__file__).parent / 'samples'
11
12 def test_tomlify(copy_sample, monkeypatch):
13 td = copy_sample('with_flit_ini')
14 monkeypatch.chdir(td)
15
16 tomlify.main(argv=[])
17
18 pyproject_toml = (td / 'pyproject.toml')
19 assert_isfile(pyproject_toml)
20
21 with pyproject_toml.open('rb') as f:
22 content = tomllib.load(f)
23
24 assert 'build-system' in content
25 assert 'tool' in content
26 assert 'flit' in content['tool']
27 flit_table = content['tool']['flit']
28 assert 'metadata' in flit_table
29 assert 'scripts' in flit_table
30 assert 'entrypoints' in flit_table