Coverage for tests/unit_tests/scons/test_apio_env.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.17.2, created at 2026-11-07 05:08 +0000

1# This file is part of the Apio project 

2# (C) 2016-present FPGAwars 

3# Project authors: 

4# * Jesús Arroyo (Jesus89) (2016-2019) 

5# * Juan Gonzalez (obijuan) (2019-2024) 

6# * The Apio Team (2024-present) 

7# License: GPLv2 

8 

9""" 

10Tests of the scons ApioEnv. 

11""" 

12 

13from tests.unit_tests.scons.testing import make_test_apio_env 

14 

15 

16def test_env_platform_id(): 

17 """Tests the env handling of the platform_id param.""" 

18 

19 # -- Test with a non windows platform id. 

20 env = make_test_apio_env(platform_id="darwin-arm64") 

21 assert env.apio_platform.id == "darwin-arm64" 

22 assert not env.apio_platform.is_windows 

23 

24 # -- Test with a windows platform id. 

25 env = make_test_apio_env(platform_id="windows-amd64") 

26 assert env.apio_platform.id == "windows-amd64" 

27 assert env.apio_platform.is_windows 

28 

29 

30def test_targeting_one_if(): 

31 """Test the targeting_one_if() method.""" 

32 

33 # -- The test env targets 'build'. 

34 apio_env = make_test_apio_env() 

35 

36 assert apio_env.targeting_one_of("build") 

37 assert apio_env.targeting_one_of("upload", "build") 

38 assert not apio_env.targeting_one_of("upload")