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
« 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
9"""
10Tests of scons_filters.py
11"""
13from apio.managers.scons_filter import PnrRangeDetector, PipeId
15# TODO: Add testing of on_line() including line coloring and line ignoring.
18def test_pnr_range_detector():
19 """Tests the pnr range class."""
21 # -- Create a PNR range detector.
22 rd = PnrRangeDetector()
24 # -- Starting out of range
25 assert not rd.update(PipeId.STDOUT, "hello world")
26 assert not rd.update(PipeId.STDOUT, "hello world")
28 # -- Start of range trigger (from next line)
29 assert not rd.update(PipeId.STDOUT, "nextpnr-ice40 bla bla")
31 # -- In range.
32 assert rd.update(PipeId.STDOUT, "bla bla")
33 assert rd.update(PipeId.STDOUT, "info: bla bla")
35 # -- End of range trigger. (from next line)
36 assert rd.update(PipeId.STDERR, "Program finished normally.")
38 # -- out of range.
39 assert not rd.update(PipeId.STDOUT, "bla bla")