File: test_consistency.py

package info (click to toggle)
meson-python 0.18.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,264 kB
  • sloc: python: 3,005; ansic: 326; makefile: 8
file content (32 lines) | stat: -rw-r--r-- 1,017 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# SPDX-FileCopyrightText: 2021 The meson-python developers
#
# SPDX-License-Identifier: MIT

import pathlib
import sys


if sys.version_info >= (3, 11):
    import tomllib
else:
    import tomli as tomllib

import mesonpy


def test_version():
    pyproject = pathlib.Path(__file__).parent.parent.joinpath('pyproject.toml')
    with open(pyproject, 'rb') as f:
        project_version = tomllib.load(f)['project']['version']
    assert mesonpy.__version__ == project_version


def test_pyproject_dependencies():
    pyproject = pathlib.Path(__file__).parent.parent.joinpath('pyproject.toml')
    with open(pyproject, 'rb') as f:
        data = tomllib.load(f)
    build_dependencies = data['build-system']['requires']
    project_dependencies = data['project']['dependencies']
    # verify that all build dependencies are project dependencies
    assert not set(build_dependencies) - set(project_dependencies), \
        'pyproject.toml is inconsistent: not all "build-system.requires" are in "project.dependencies"'