@@ -693,6 +693,7 @@ def test_foobar(bad):
693693 assert result .ret == 0
694694
695695
696+ @pytest .mark .skipif ('sys.platform == "win32"' , reason = 'No redis server on Windows' )
696697def test_celery (pytester ):
697698 pytester .makepyfile (
698699 small_celery = """
@@ -1259,17 +1260,26 @@ def test_run():
12591260@pytest .mark .parametrize (
12601261 'setup' ,
12611262 [
1262- ('signal.signal(signal.SIGBREAK, signal.SIG_DFL); cleanup_on_signal(signal.SIGBREAK) ' , '87 % 21-22 ' ),
1263- ('cleanup_on_signal (signal.SIGBREAK)' , '87% 21-22 ' ),
1264- ('cleanup() ' , '73 % 19-22 ' ),
1263+ ('signal.signal(signal.SIGBREAK, signal.SIG_DFL)' , '62 % 4, 23-28 ' ),
1264+ ('signal.signal (signal.SIGBREAK, cleanup )' , '100% ' ),
1265+ ('' , '67 % 4, 25-28 ' ),
12651266 ],
12661267)
12671268def test_cleanup_on_sigterm_sig_break (pytester , testdir , setup ):
12681269 # worth a read: https://stefan.sofa-rockers.org/2013/08/15/handling-sub-process-hierarchies-python-linux-os-x/
1270+ testdir .makepyprojecttoml (
1271+ """
1272+ [tool.coverage.run]
1273+ patch = ["subprocess"]
1274+ """
1275+ )
12691276 script = testdir .makepyfile (
12701277 """
12711278import os, signal, subprocess, sys, time
12721279
1280+ def cleanup(num, frame):
1281+ raise Exception()
1282+
12731283def test_run():
12741284 proc = subprocess.Popen(
12751285 [sys.executable, __file__],
@@ -1280,7 +1290,11 @@ def test_run():
12801290 proc.send_signal(signal.CTRL_BREAK_EVENT)
12811291 stdout, stderr = proc.communicate()
12821292 assert not stderr
1283- assert stdout in [b"^C", b"", b"captured IOError(4, 'Interrupted function call')\\ n"]
1293+ assert stdout in [
1294+ b"^C",
1295+ b"",
1296+ b"captured Exception()\\ r\\ n",
1297+ b"captured IOError(4, 'Interrupted function call')\\ n"]
12841298
12851299if __name__ == "__main__":
12861300 """
@@ -1620,17 +1634,6 @@ def test_foo():
16201634SCRIPT_SIMPLE_RESULT = '4 * 100%'
16211635
16221636
1623- @pytest .mark .skipif ('tuple(map(int, xdist.__version__.split("."))) >= (3, 0, 2)' , reason = '--boxed option was removed in version 3.0.2' )
1624- @pytest .mark .skipif ('sys.platform == "win32"' )
1625- def test_dist_boxed (testdir ):
1626- script = testdir .makepyfile (SCRIPT_SIMPLE )
1627-
1628- result = testdir .runpytest ('-v' , '--assert=plain' , f'--cov={ script .dirpath ()} ' , '--boxed' , script )
1629-
1630- result .stdout .fnmatch_lines (['*_ coverage: platform *, python * _*' , f'test_dist_boxed* { SCRIPT_SIMPLE_RESULT } *' , '*1 passed*' ])
1631- assert result .ret == 0
1632-
1633-
16341637@pytest .mark .skipif ('sys.platform == "win32"' )
16351638@pytest .mark .skipif ('platform.python_implementation() == "PyPy"' , reason = 'strange optimization on PyPy3' )
16361639def test_dist_bare_cov (testdir ):
0 commit comments