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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
import os
import pytest
from ci_tools.parsing import ParsedSetup
from ci_tools.functions import get_config_setting
integration_folder = os.path.join(os.path.dirname(__file__), "integration")
def test_toml_result():
package_with_toml = os.path.join(integration_folder, "scenarios", "optional_environment_two_options")
parsed_setup = ParsedSetup.from_path(package_with_toml)
actual = parsed_setup.get_build_config()
expected = {
"mypy": True,
"type_check_samples": True,
"verifytypes": True,
"pyright": True,
"pylint": True,
"black": True,
"optional": [
{
"name": "no_requests",
"install": [],
"uninstall": ["requests"],
"additional_pytest_args": ["-k", "*_async.py"],
},
{
"name": "no_aiohttp",
"install": [],
"uninstall": ["aiohttp"],
"additional_pytest_args": ["-k", "not *_async.py"],
},
],
}
assert actual == expected
def test_optional_specific_get():
package_with_toml = os.path.join(integration_folder, "scenarios", "optional_environment_two_options")
actual = get_config_setting(package_with_toml, "optional")
expected = [
{
"name": "no_requests",
"install": [],
"uninstall": ["requests"],
"additional_pytest_args": ["-k", "*_async.py"],
},
{
"name": "no_aiohttp",
"install": [],
"uninstall": ["aiohttp"],
"additional_pytest_args": ["-k", "not *_async.py"],
},
]
assert expected == actual
def test_optional_specific_get_no_result():
package_with_toml = os.path.join(integration_folder, "scenarios", "optional_environment_zero_options")
actual = get_config_setting(package_with_toml, "optional", None)
expected = None
assert expected == actual
|