question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why so many test messages?

See original GitHub issue

Hi,

I’m writing a cocotb test that will loop through a list of test functions and call them. The test looks like this:

@cocotb.test()
async def test_08_factory_tests(dut):
    """Tests different aspects of the factory"""
    tc08 = t08.s08_factory_classes_TestCase()
    methods = inspect.getmembers(t08.s08_factory_classes_TestCase)#, predicate=inspect.ismethod)
    for mm in methods:
        (name,function) = mm
        if name.startswith("test_"):
            test = getattr(tc08, name)
            tc08.setUp()
            print(f"**** Running: {name}")
            test()
            tc08.tearDown()

The functions run if they start with “test_”

    def test_no_assert(self):
        pass

    def test_no_assert2(self):
        pass

Strangely, when I run this all the messages from cocotb get repeated once per function, even though they are all in one test:

**** Running: test_no_assert
**** Running: test_no_assert2
  1000.00ns INFO     cocotb.regression                         regression.py:364  in _score_test                     Test Passed: test_08_factory_tests
INFO: regression.py(364)[cocotb.regression]: Test Passed: test_08_factory_tests
INFO: regression.py(364)[cocotb.regression]: Test Passed: test_08_factory_tests
  1000.00ns INFO     cocotb.regression                         regression.py:487  in _log_test_summary               Passed 1 tests (0 skipped)
INFO: regression.py(487)[cocotb.regression]: Passed 1 tests (0 skipped)
INFO: regression.py(487)[cocotb.regression]: Passed 1 tests (0 skipped)

And then later

INFO: regression.py(557)[cocotb.regression]: **********************************************************************************************
** TEST                                  PASS/FAIL  SIM TIME(NS)  REAL TIME(S)  RATIO(NS/S) **
**********************************************************************************************
** tinyalu_cocotb.test_08_factory_tests    PASS         1000.00          0.00   1533566.36  **
**********************************************************************************************

INFO: regression.py(557)[cocotb.regression]: **********************************************************************************************
** TEST                                  PASS/FAIL  SIM TIME(NS)  REAL TIME(S)  RATIO(NS/S) **
**********************************************************************************************
** tinyalu_cocotb.test_08_factory_tests    PASS         1000.00          0.00   1533566.36  **

This is filling up my log with a lot of garbage. Any idea why this is happening?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
eric-wiesercommented, Jul 27, 2021

That is, I would recommend doing at the top of your file:

uvm_root_logger = logging.getLogger('uvm')

and then inside your __init__, replacing

-self.logger = logging.getLogger(full_name) 
+self.logger = uvm_root_logger.getChild(full_name)

If you attach the handlers to uvm_root_logger, then you also don’t need to copy them to every logger.

0reactions
raysalemicommented, Jul 27, 2021

That is, I would recommend doing at the top of your file:

uvm_root_logger = logging.getLogger('uvm')

and then inside your __init__, replacing

-self.logger = logging.getLogger(full_name) 
+self.logger = uvm_root_logger.getChild(full_name)

If you attach the handlers to uvm_root_logger, then you also don’t need to copy them to every logger.

Done. Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Stop Spam Texts - Kaspersky
Spam text messages are annoying & can often be a scam. ... Not only are unwanted text messages extremely annoying, but in many...
Read more >
Getting more spam texts and emails? Here's how to fix it
You get spam messages because someone gets access to your email address or phone number. Think about how often you provide your phone...
Read more >
Getting more spam text messages? How to avoid and report ...
Getting more spam text messages? How to avoid and report the latest schemes · First, never open the link · Do research before...
Read more >
Protect Against Smishing, Spam Text Messages, and ... - Verizon
Spam text messages can be identified by poor grammar, misspelled words and awkward use of language. Real text messages from legitimate businesses will...
Read more >
2022 Spam Text Statistics: Are Spam Texts on the Rise?
Spam texts are definitely on the rise. While COVID-19 and the TRACED Act have contributed to the rising text spam rates, the growth...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found