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.

test_main.py: test_debug_0 fails

See original GitHub issue

Hi,

While packaging 1.2.2 in Debian, I met failures in the test phase with test_debug_0.

Indeed, the assertion fails: the effective level of the logger after the run of main((‘-n’,)) is ERROR and not WARNING as expected.

I can reproduce the behaviour in any ipython3 shell in 3.9 and 3.7:

Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
Type "copyright", "credits" or "license" for more information.

IPython 5.8.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import logging

In [2]: s = logging.getLogger('mail.log')

In [3]: s
Out[3]: <Logger mail.log (WARNING)>

In [4]: logging.basicConfig(level=logging.ERROR)

In [5]: s
Out[5]: <Logger mail.log (ERROR)>

What am I missing here?

Cheers!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
P-EBcommented, Jan 16, 2021

@pepoluan No worries for me to close the bug, I was just asking in case you had an idea about what could be the cause of the failure. I use pytest now for these tests! 😃

Thanks for taking the time to answer!

0reactions
pepoluancommented, Jan 7, 2021

Well, considering that

  1. This seems to be an upstream issue, and
  2. This behavior is not exhibited if tests are run using the documented testing procedure (i.e., running tox which will run nose2/pytest), and
  3. There is no activity on this for 2 weeks (aside from me adding a label)

I’m going to close this issue.

Feel free to reopen if you think this is important and aiosmtpd can do something about this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

go - TestMain - no tests to run - Stack Overflow
#1. Trying to run TestMain() is like trying to run main() . You don't do that, the OS does this for you. TestMain...
Read more >
"TestMain(m *testing.M)" runs as a test itself but is failing
I'm using a file main_test.go to run my tests. There are 4 tests total but my run tells me that 1 test failed...
Read more >
Why use TestMain for testing in Go? - Medium
The TestMain function was released with Go 1.4 about 2 years ago and I feel like it is still not used enough. ......
Read more >
unittest — Unit testing framework — Python 3.11.1 ...
If the test fails, an exception will be raised with an explanatory message, and unittest will identify the test case as a failure....
Read more >
Getting Started With Testing in Python
Handling Expected Failures ; Isolating Behaviors in Your Application; Writing Integration Tests; Testing Data-Driven Applications.
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