Coverage for tests/unit_tests/managers/test_scons_filters.py: 100%

10 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 scons_filters.py 

11""" 

12 

13from apio.managers.scons_filter import PnrRangeDetector, PipeId 

14 

15# TODO: Add testing of on_line() including line coloring and line ignoring. 

16 

17 

18def test_pnr_range_detector(): 

19 """Tests the pnr range class.""" 

20 

21 # -- Create a PNR range detector. 

22 rd = PnrRangeDetector() 

23 

24 # -- Starting out of range 

25 assert not rd.update(PipeId.STDOUT, "hello world") 

26 assert not rd.update(PipeId.STDOUT, "hello world") 

27 

28 # -- Start of range trigger (from next line) 

29 assert not rd.update(PipeId.STDOUT, "nextpnr-ice40 bla bla") 

30 

31 # -- In range. 

32 assert rd.update(PipeId.STDOUT, "bla bla") 

33 assert rd.update(PipeId.STDOUT, "info: bla bla") 

34 

35 # -- End of range trigger. (from next line) 

36 assert rd.update(PipeId.STDERR, "Program finished normally.") 

37 

38 # -- out of range. 

39 assert not rd.update(PipeId.STDOUT, "bla bla")