Visitar URL original
Skip tests that pollute the execution environment for some reason · RustPython/RustPython@7bf9c34 · GitHub
Skip to content

Commit 7bf9c34

Browse files
committed
Skip tests that pollute the execution environment for some reason
1 parent d872068 commit 7bf9c34

7 files changed

Lines changed: 74 additions & 2 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,32 @@ env:
105105
test_unpack
106106
test_weakref
107107
test_yield_from
108+
ENV_POLLUTING_TESTS_COMMON: >-
109+
test_raise
110+
test_ssl
111+
test_sys
112+
ENV_POLLUTING_TESTS_LINUX: >-
113+
test.test_multiprocessing_fork.test_processes
114+
test.test_multiprocessing_fork.test_threads
115+
test.test_multiprocessing_forkserver.test_processes
116+
test.test_multiprocessing_forkserver.test_threads
117+
test.test_multiprocessing_spawn.test_processes
118+
test.test_multiprocessing_spawn.test_threads
119+
test_file_eintr
120+
test_subprocess
121+
ENV_POLLUTING_TESTS_MACOS: >-
122+
test_multiprocessing_forkserver.test_manager
123+
test.test_multiprocessing_forkserver.test_misc
124+
test.test_multiprocessing_forkserver.test_processes
125+
test.test_multiprocessing_forkserver.test_threads
126+
test.test_multiprocessing_spawn.test_manager
127+
test.test_multiprocessing_spawn.test_misc
128+
test.test_multiprocessing_spawn.test_processes
129+
test.test_multiprocessing_spawn.test_threads
130+
test_ftplib
131+
test_logging
132+
test_multiprocessing_main_handling
133+
test_subprocess
108134
# Python version targeted by the CI.
109135
PYTHON_VERSION: "3.13.1"
110136

@@ -292,26 +318,47 @@ jobs:
292318

293319
- if: runner.os == 'Linux'
294320
name: run cpython platform-independent tests
321+
env:
322+
RUSTPYTHON_SKIP_ENV_POLLUTERS: true
295323
run:
296324
target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed --timeout 600 -v ${{ env.PLATFORM_INDEPENDENT_TESTS }}
297325
timeout-minutes: 35
298326

299327
- if: runner.os == 'Linux'
300328
name: run cpython platform-dependent tests (Linux)
329+
env:
330+
RUSTPYTHON_SKIP_ENV_POLLUTERS: true
301331
run: target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed --timeout 600 -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }}
302332
timeout-minutes: 35
303333

304334
- if: runner.os == 'macOS'
305335
name: run cpython platform-dependent tests (MacOS)
336+
env:
337+
RUSTPYTHON_SKIP_ENV_POLLUTERS: true
306338
run: target/release/rustpython -m test -j 1 --slowest --fail-env-changed --timeout 600 -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }}
307339
timeout-minutes: 35
308340

309341
- if: runner.os == 'Windows'
310342
name: run cpython platform-dependent tests (windows partial - fixme)
343+
env:
344+
RUSTPYTHON_SKIP_ENV_POLLUTERS: true
311345
run:
312346
target/release/rustpython -m test -j 1 --slowest --fail-env-changed --timeout 600 -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} ${{ env.WINDOWS_SKIPS }}
313347
timeout-minutes: 45
314348

349+
- if: runner.os == 'Linux'
350+
name: run cpython tests to check if env polluters have stopped polluting (Common/Linux)
351+
run: |
352+
for thing in ${{ env.ENV_POLLUTING_TESTS_COMMON }} ${{ env.ENV_POLLUTING_TESTS_LINUX }}; do
353+
! target/release/rustpython -m test -j 1 --slowest --fail-env-changed --timeout 600 -v ${thing}
354+
exitcode=$?
355+
if [ $exitcode -ne 0 ]; then
356+
echo "Test ${thing} is no longer polluting the environment!"
357+
exit 422
358+
fi
359+
done
360+
timeout-minutes: 15
361+
315362
- if: runner.os != 'Windows'
316363
name: check that --install-pip succeeds
317364
run: |

‎Lib/test/test_file_eintr.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ def test_readall(self):
186186
class CTestFileIOSignalInterrupt(TestFileIOSignalInterrupt, unittest.TestCase):
187187
modname = '_io'
188188

189+
@unittest.skipIf(
190+
'RUSTPYTHON_SKIP_ENV_POLLUTERS' in os.environ,
191+
"TODO: RUSTPYTHON environment pollution when running rustpython -m test --fail-env-changed due to unknown reason"
192+
)
189193
# TODO: RUSTPYTHON - _io.FileIO.readall uses read_to_end which differs from _pyio.FileIO.readall
190194
@unittest.expectedFailure
191195
def test_readall(self):

‎Lib/test/test_importlib/resources/test_resource.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ def test_is_file_failure_does_not_keep_open(self):
192192
def test_as_file_does_not_keep_open(self): # pragma: no cover
193193
resources.as_file(resources.files('ziptestdata') / 'binary.file')
194194

195+
import os # TODO: RUSTPYTHON see below
196+
@unittest.skipIf(
197+
'RUSTPYTHON_SKIP_ENV_POLLUTERS' in os.environ,
198+
"TODO: RUSTPYTHON environment pollution when running rustpython -m test --fail-env-changed due to tmpfile leak"
199+
)
195200
def test_entered_path_does_not_keep_open(self):
196201
"""
197202
Mimic what certifi does on import to make its bundle

‎Lib/test/test_raise.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,11 @@ def f():
464464

465465
f()
466466

467+
import os # TODO: RUSTPYTHON see below
468+
@unittest.skipIf(
469+
'RUSTPYTHON_SKIP_ENV_POLLUTERS' in os.environ,
470+
"TODO: RUSTPYTHON environment pollution when running rustpython -m test --fail-env-changed due to unraisable exception"
471+
)
467472
def test_3611(self):
468473
import gc
469474
# A re-raised exception in a __del__ caused the __context__

‎Lib/test/test_ssl.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4299,6 +4299,10 @@ def cb_returning_alert(ssl_sock, server_name, initial_context):
42994299
sni_name='supermessage')
43004300
self.assertEqual(cm.exception.reason, 'TLSV1_ALERT_ACCESS_DENIED')
43014301

4302+
@unittest.skipIf(
4303+
'RUSTPYTHON_SKIP_ENV_POLLUTERS' in os.environ,
4304+
"TODO: RUSTPYTHON environment pollution when running rustpython -m test --fail-env-changed due to unraisable exception"
4305+
)
43024306
@unittest.expectedFailure # TODO: RUSTPYTHON
43034307
def test_sni_callback_raising(self):
43044308
# Raising fails the connection with a TLS handshake failure alert.

‎Lib/test/test_subprocess.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,8 +1292,10 @@ def test_universal_newlines_communicate_stdin_stdout_stderr(self):
12921292
# to stderr at exit of subprocess.
12931293
self.assertTrue(stderr.startswith("eline2\neline6\neline7\n"))
12941294

1295-
# TODO: RUSTPYTHON
1296-
@unittest.expectedFailure
1295+
@unittest.skipIf(
1296+
'RUSTPYTHON_SKIP_ENV_POLLUTERS' in os.environ,
1297+
"TODO: RUSTPYTHON environment pollution when running rustpython -m test --fail-env-changed due to unknown reason"
1298+
)
12971299
def test_universal_newlines_communicate_encodings(self):
12981300
# Check that universal newlines mode works for various encodings,
12991301
# in particular for encodings in the UTF-16 and UTF-32 families.

‎Lib/test/test_sys.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,11 @@ def g456():
595595
leave_g.set()
596596
t.join()
597597

598+
import os # TODO: RUSTPYTHON see below
599+
@unittest.skipIf(
600+
'RUSTPYTHON_SKIP_ENV_POLLUTERS' in os.environ,
601+
"TODO: RUSTPYTHON environment pollution when running rustpython -m test --fail-env-changed due to dangling threads"
602+
)
598603
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'sys' has no attribute '_current_exceptions'
599604
@threading_helper.reap_threads
600605
@threading_helper.requires_working_threading()

0 commit comments

Comments
 (0)