Closed
Description
Describe the bug
I have a "regular" unittest script, in which I am creating an "echo server" using multitprocessing.process. To start the server I do the following:
def tcp_server(host, port):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((host, port))
s.listen()
while True:
conn, addr = s.accept()
with conn:
while data := conn.recv(1024):
conn.sendall(data)
class TestEcho(TestCase):
def setUp(self) -> None:
self.server = multiprocessing.Process(target=tcp_server, args=('127.0.0.1', 1235))
self.server.start()
def tearDown(self) -> None:
self.server.terminate()
while self.server.is_alive()
sleep(0.1)
def test1(self):
.....
my .coveragerc looks like this:
[run]
parallel = True
concurrency = multiprocessing
[report]
omit = tests/**/__init__.py
To run my tests, I use the following script:
export COVERAGE_PROCESS_START=.coveragerc
coverage run -m unittest discover -s ./tests
coverage combine
coverage report -m
and when getting the report... there are files that I am sure have been executed (as the tests are successful) but they get reported as missing.
To Reproduce
How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:
- What version of Python are you using? 3.10.1
- What version of coverage.py shows the problem? 6.2
- What versions of what packages do you have installed?
asgiref==3.4.1
blinker==1.4
Brotli==1.0.9
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.9
click==8.0.3
colorama==0.4.4
container-app-conf==5.2.2
coverage==6.2
cryptography==3.4.8
cycler==0.11.0
ffmpeg-normalize==1.22.4
ffmpeg-progress-yield==0.2.0
Flask==2.0.2
Flask-SQLAlchemy==2.5.1
fonttools==4.28.5
forex-python==1.8
greenlet==1.1.2
h11==0.12.0
h2==4.1.0
hpack==4.0.0
hyperframe==6.0.1
idna==3.3
itsdangerous==2.0.1
Jinja2==3.0.3
kaitaistruct==0.9
kiwisolver==1.3.2
ldap3==2.9.1
MarkupSafe==2.0.1
matplotlib==3.5.1
mitmproxy==7.0.4
msgpack==1.0.3
numpy==1.21.5
packaging==21.3
pandas==1.3.5
passlib==1.7.4
pdftotext==2.2.2
Pillow==8.4.0
pip-date==1.0.3
protobuf==3.18.1
publicsuffix2==2.20191221
py-range-parse==1.0.5
pyasn1==0.4.8
pycparser==2.21
pycryptodome==3.12.0
pyOpenSSL==20.0.1
pyparsing==2.4.7
pyperclip==1.8.2
pyserial==3.5
python-dateutil==2.8.2
python-dotenv==0.19.2
pytimeparse==1.1.8
pytz==2021.3
PyYAML==6.0
requests==2.26.0
ruamel.yaml==0.17.16
ruamel.yaml.clib==0.2.6
scipy==1.7.3
simplejson==3.17.6
six==1.16.0
sortedcontainers==2.4.0
SQLAlchemy==1.4.29
tenacity==8.0.1
toml==0.10.2
tornado==6.1
tqdm==4.62.3
urllib3==1.26.7
urwid==2.1.2
voluptuous==0.12.2
Werkzeug==2.0.2
wsproto==1.0.0
XlsxWriter==3.0.2
youtube-dl==2021.12.17
zstandard==0.15.2
Additional context
Add any other context about the problem here.