Interrupted: 1 error during collection, SystemExit: 0
See original GitHub issuePackage Version
------------ -------
atomicwrites 1.4.0
attrs 21.4.0
colorama 0.4.4
iniconfig 1.1.1
packaging 21.3
pip 21.2.3
pluggy 1.0.0
py 1.11.0
pyparsing 3.0.8
pytest 7.1.1
setuptools 57.4.0
tomli 2.0.1
Call python test.py (https://docs.pytest.org/en/7.1.x/how-to/usage.html#calling-pytest-from-python-code)
def test_percent():
pass
import pytest,sys
pytest.main([sys.argv[0], '-vvv',])
exit(0)
Output:
========================================================================== test session starts ===========================================================================
platform win32 -- Python 3.9.7, pytest-7.1.1, pluggy-1.0.0 -- C:\Python\python.exe
cachedir: .pytest_cache
rootdir: C:\Python
collected 0 items / 1 error
================================================================================= ERRORS =================================================================================
_____________________________________________________________________ ERROR collecting test session ______________________________________________________________________
d:\test.py:6: in <module>
exit(0)
lib\_sitebuiltins.py:26: in __call__
raise SystemExit(code)
E SystemExit: 0
---------------------------------------------------------------------------- Captured stdout -----------------------------------------------------------------------------
============================= test session starts =============================
platform win32 -- Python 3.9.7, pytest-7.1.1, pluggy-1.0.0 -- C:\Python\python.exe
cachedir: .pytest_cache
rootdir: C:\Python
collecting ... collected 1 item
::test_percent <- d:\test.py PASSED [100%]
============================== 1 passed in 0.01s ==============================
======================================================================== short test summary info =========================================================================
ERROR - SystemExit: 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================ 1 error in 0.29s ============================================================================
Code on Lib/_sitebuiltins.py:
1: """
2: The objects used by the site module to add custom builtins.
3: """
4:
5: # Those objects are almost immortal and they keep a reference to their module
6: # globals. Defining them in the site module would keep too many references
7: # alive.
8: # Note this means this module should also avoid keep things alive in its
9: # globals.
10:
11: import sys
12:
13: class Quitter(object):
14: def __init__(self, name, eof):
15: self.name = name
16: self.eof = eof
17: def __repr__(self):
18: return 'Use %s() or %s to exit' % (self.name, self.eof)
19: def __call__(self, code=None):
20: # Shells like IDLE catch the SystemExit, but listen when their
21: # stdin wrapper is closed.
22: try:
23: sys.stdin.close()
24: except:
25: pass
26: raise SystemExit(code)
Related: https://github.com/pytest-dev/pytest/issues/8986 warn when the cmdline_main hook raises systemexit
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Errors with pytest - python - Stack Overflow
Description about code: This is the code where I was getting error. I have appropriate functions defined. Working fine with first test case....
Read more >raise SystemExit(0) - USENIX
When you give a message, it is printed to sys.stderr and Python exits with a status code of. 1. Problem solved—your program gracefully...
Read more >Built-in Exceptions — Python 3.11.1 documentation
This exception is raised when a system function returns a system-related error, including I/O failures such as “file not found” or “disk full”...
Read more >Exit codes — pytest documentation
Running pytest can result in six different exit codes: Exit code 0. All tests were collected and passed successfully. Exit code 1. Tests...
Read more >Logstash stopped processing because of an error ...
Logstash has suddenly stopped collecting. If you look at the log, you will see the following ... SystemExit: (SystemExit) exit at org.jruby.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Not sure that makes 100% sense. Example codes are made to be deviated from. Otherwise you would just be coding the example. Explanations for beginners should be totally concise and make it clear what is needed in the snippet. I’ve seen so many examples online that muddy the water with unnecessary stuff and as a newbie it can be tiring to fathom out what is relevant.
All learning and training starts with replication and the divergence happens as skill and understanding grows,
Going straight to divergence without understanding or a experimental base for exploration is a bit like a fresh Mason putting bricks in weird angles for giggles
It’s all to easy to end up with a train wreck because something was missed