* feat: requires-python refactor: updating to current proposal fix: add tests and fix a few issues docs: Update mostly from @joerick docs: update README from readthedocs * refactor: pull out config file reading * fix: always assume highest Python patch version * refactor: try new design * refactor: function and bump MyPy to 0.800 * fix: tighten AST to call only, add docs * fix: address review points from @joerick
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
import toml
|
|
from packaging.version import Version
|
|
|
|
from cibuildwheel.extra import InlineArrayDictEncoder # noqa: E402
|
|
from cibuildwheel.util import resources_dir
|
|
|
|
|
|
def test_compare_configs():
|
|
with open(resources_dir / "build-platforms.toml") as f:
|
|
txt = f.read()
|
|
|
|
dict_txt = toml.loads(txt)
|
|
|
|
new_txt = toml.dumps(dict_txt, encoder=InlineArrayDictEncoder())
|
|
print(new_txt)
|
|
|
|
assert new_txt == txt
|
|
|
|
|
|
def test_dump_with_Version():
|
|
example = {
|
|
"windows": {
|
|
"python_configurations": [
|
|
{"identifier": "cp27-win32", "version": Version("2.7.18"), "arch": "32"},
|
|
{"identifier": "cp27-win_amd64", "version": Version("2.7.18"), "arch": "64"},
|
|
]
|
|
}
|
|
}
|
|
|
|
result = """\
|
|
[windows]
|
|
python_configurations = [
|
|
{ identifier = "cp27-win32", version = "2.7.18", arch = "32" },
|
|
{ identifier = "cp27-win_amd64", version = "2.7.18", arch = "64" },
|
|
]
|
|
"""
|
|
|
|
output = toml.dumps(example, encoder=InlineArrayDictEncoder())
|
|
print(output)
|
|
assert output == result
|