From bf5cdec74397ac91770e1b23c868061a140ba6d8 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 6 Jan 2022 09:37:14 +0100 Subject: [PATCH] QA test code: fix some issues: - in python tests force the "C" locale is in use (remove wx alerts in some locales) - disable some new DRC tests that are irrelevant in QA tests and create false positives --- qa/pcbnew/drc/test_drc_regressions.cpp | 10 +++++++++- qa/pcbnew/test_tracks_cleaner.cpp | 8 +++++++- qa/test.py | 5 +++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/qa/pcbnew/drc/test_drc_regressions.cpp b/qa/pcbnew/drc/test_drc_regressions.cpp index 28d6575ea5..3a65ba7a9f 100644 --- a/qa/pcbnew/drc/test_drc_regressions.cpp +++ b/qa/pcbnew/drc/test_drc_regressions.cpp @@ -65,8 +65,11 @@ BOOST_FIXTURE_TEST_CASE( DRCFalsePositiveRegressions, DRC_REGRESSION_TEST_FIXTUR std::vector violations; BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); + // Disable DRC tests not useful in this testcase bds.m_DRCSeverities[ DRCE_INVALID_OUTLINE ] = SEVERITY::RPT_SEVERITY_IGNORE; bds.m_DRCSeverities[ DRCE_UNCONNECTED_ITEMS ] = SEVERITY::RPT_SEVERITY_IGNORE; + bds.m_DRCSeverities[ DRCE_COPPER_SLIVER ] = SEVERITY::RPT_SEVERITY_IGNORE; + bds.m_DRCSeverities[ DRCE_STARVED_THERMAL ] = SEVERITY::RPT_SEVERITY_IGNORE; bds.m_DRCEngine->SetViolationHandler( [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) @@ -124,6 +127,11 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR std::vector violations; BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); + // Disable DRC tests not useful in this testcase + bds.m_DRCSeverities[ DRCE_COPPER_SLIVER ] = SEVERITY::RPT_SEVERITY_IGNORE; + bds.m_DRCSeverities[ DRCE_STARVED_THERMAL ] = SEVERITY::RPT_SEVERITY_IGNORE; + bds.m_DRCSeverities[ DRCE_LIB_FOOTPRINT_ISSUES ] = SEVERITY::RPT_SEVERITY_IGNORE; + bds.m_DRCEngine->SetViolationHandler( [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) { @@ -149,7 +157,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR for( const DRC_ITEM& item : violations ) { - BOOST_TEST_MESSAGE( item.ShowReport( EDA_UNITS::INCHES, RPT_SEVERITY_ERROR, + BOOST_TEST_MESSAGE( item.ShowReport( EDA_UNITS::INCHES, RPT_SEVERITY_ERROR, itemMap ) ); } diff --git a/qa/pcbnew/test_tracks_cleaner.cpp b/qa/pcbnew/test_tracks_cleaner.cpp index 0833fef5da..8cf1a9e3eb 100644 --- a/qa/pcbnew/test_tracks_cleaner.cpp +++ b/qa/pcbnew/test_tracks_cleaner.cpp @@ -135,7 +135,8 @@ BOOST_FIXTURE_TEST_CASE( TrackCleanerRegressionTests, TRACK_CLEANER_TEST_FIXTURE */ std::vector tests = { "issue832", "issue4257", - "issue8909" }; + "issue8909" + }; for( const wxString& relPath : tests ) { @@ -170,6 +171,11 @@ BOOST_FIXTURE_TEST_CASE( TrackCleanerRegressionTests, TRACK_CLEANER_TEST_FIXTURE std::vector violations; BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); + // Disable some DRC tests not useful in this testcase + bds.m_DRCSeverities[ DRCE_LIB_FOOTPRINT_ISSUES ] = SEVERITY::RPT_SEVERITY_IGNORE; + bds.m_DRCSeverities[ DRCE_COPPER_SLIVER ] = SEVERITY::RPT_SEVERITY_IGNORE; + bds.m_DRCSeverities[ DRCE_STARVED_THERMAL ] = SEVERITY::RPT_SEVERITY_IGNORE; + bds.m_DRCEngine->SetViolationHandler( [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) { diff --git a/qa/test.py b/qa/test.py index 09fb951574..62d748320c 100644 --- a/qa/test.py +++ b/qa/test.py @@ -2,6 +2,7 @@ import unittest import platform import sys import argparse +import locale if platform.python_version() < '2.7': unittest = __import__('unittest2') @@ -29,6 +30,10 @@ if __name__ == '__main__': print("Install the xmlrunner package.") sys.exit(2) + # Useful in some non English installs (using a comma as load number separator) to avoid + # wxWidgets alerts when running the test code + locale.setlocale(locale.LC_ALL, 'C') + testsuite = unittest.TestLoader().discover('testcases', pattern="*.py") if args.xml: