mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-30 22:11:59 -09:00
support/testing: new python-pydantic-settings runtime test
Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
Signed-off-by: Arnout Vandecappelle <arnout@rnout.be>
(cherry picked from commit 5eb46878bd)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
committed by
Thomas Perale
parent
b1ea70d9ea
commit
ae31c77be3
@@ -2259,10 +2259,12 @@ F: package/python-ruamel-yaml-clib/
|
|||||||
F: package/python-waitress/
|
F: package/python-waitress/
|
||||||
F: support/testing/tests/package/test_python_fastapi.py
|
F: support/testing/tests/package/test_python_fastapi.py
|
||||||
F: support/testing/tests/package/test_python_pydantic.py
|
F: support/testing/tests/package/test_python_pydantic.py
|
||||||
|
F: support/testing/tests/package/test_python_pydantic_settings.py
|
||||||
F: support/testing/tests/package/test_python_ruamel_yaml.py
|
F: support/testing/tests/package/test_python_ruamel_yaml.py
|
||||||
F: support/testing/tests/package/test_python_waitress.py
|
F: support/testing/tests/package/test_python_waitress.py
|
||||||
F: support/testing/tests/package/sample_python_fastapi.py
|
F: support/testing/tests/package/sample_python_fastapi.py
|
||||||
F: support/testing/tests/package/sample_python_pydantic.py
|
F: support/testing/tests/package/sample_python_pydantic.py
|
||||||
|
F: support/testing/tests/package/sample_python_pydantic_settings.py
|
||||||
F: support/testing/tests/package/sample_python_ruamel_yaml.py
|
F: support/testing/tests/package/sample_python_ruamel_yaml.py
|
||||||
|
|
||||||
N: Marek Belisko <marek.belisko@open-nandra.com>
|
N: Marek Belisko <marek.belisko@open-nandra.com>
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
from pydantic_settings import BaseSettings
|
||||||
|
|
||||||
|
|
||||||
|
class Settings(BaseSettings):
|
||||||
|
api_key: str
|
||||||
|
|
||||||
|
|
||||||
|
assert Settings().api_key == "ABCD1234"
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from tests.package.test_python import TestPythonPackageBase
|
||||||
|
|
||||||
|
|
||||||
|
class TestPythonPy3PydanticSettings(TestPythonPackageBase):
|
||||||
|
__test__ = True
|
||||||
|
config = """
|
||||||
|
BR2_arm=y
|
||||||
|
BR2_cortex_a9=y
|
||||||
|
BR2_ARM_ENABLE_NEON=y
|
||||||
|
BR2_ARM_ENABLE_VFP=y
|
||||||
|
BR2_TOOLCHAIN_EXTERNAL=y
|
||||||
|
BR2_PACKAGE_PYTHON3=y
|
||||||
|
BR2_PACKAGE_PYTHON_PYDANTIC_SETTINGS=y
|
||||||
|
BR2_TARGET_ROOTFS_CPIO=y
|
||||||
|
# BR2_TARGET_ROOTFS_TAR is not set
|
||||||
|
"""
|
||||||
|
sample_scripts = ["tests/package/sample_python_pydantic_settings.py"]
|
||||||
|
timeout = 30
|
||||||
|
|
||||||
|
def login(self):
|
||||||
|
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||||
|
self.emulator.boot(
|
||||||
|
arch="armv7", kernel="builtin", options=["-initrd", cpio_file]
|
||||||
|
)
|
||||||
|
self.emulator.login()
|
||||||
|
|
||||||
|
def run_sample_scripts(self):
|
||||||
|
"""Run sample script while setting an environment variable"""
|
||||||
|
for script in self.sample_scripts:
|
||||||
|
cmd = (
|
||||||
|
"api_key=ABCD1234 " + self.interpreter + " " + os.path.basename(script)
|
||||||
|
)
|
||||||
|
self.assertRunOk(cmd, timeout=self.timeout)
|
||||||
Reference in New Issue
Block a user