Skip to content

Commit 52aaef8

Browse files
sobolevnkingiler
authored andcommitted
Remove incorrect @expectedFailures from test_cmd_line (RustPython#5201)
After you suggestion in python/cpython#116504 (comment) I went to take a look at `test_cmd_line` in RustPython (it was so long ago I contributed to this amazing project, so may thing had changed!), and I've noticed this. This is a problem, here' the simplest demo: ```python import unittest class TestMe(unittest.TestCase): @unittest.expectedFailure def test_me(self): def run(): raise ValueError with self.subTest(run=run): run() if __name__ == '__main__': unittest.main() ``` This works as expected: ``` » ./python.exe ex.py x ---------------------------------------------------------------------- Ran 1 test in 0.001s OK (expected failures=1) ``` This does not: ```python import unittest class TestMe(unittest.TestCase): def test_me(self): @unittest.expectedFailure def run(): raise ValueError with self.subTest(run=run): run() if __name__ == '__main__': unittest.main() ``` Produces: ``` » ./python.exe ex.py E ====================================================================== ERROR: test_me (__main__.TestMe.test_me) (run=<function TestMe.test_me.<locals>.run at 0x1057a2150>) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/sobolev/Desktop/cpython2/ex.py", line 10, in test_me run() ~~~^^ File "/Users/sobolev/Desktop/cpython2/ex.py", line 7, in run raise ValueError ValueError ---------------------------------------------------------------------- Ran 1 test in 0.001s FAILED (errors=1) ``` So, I propose to remove these decorators, let's only keep `TODO` comments to indicate separate failures.
1 parent e110977 commit 52aaef8

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

Lib/test/test_cmd_line.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,11 @@ def test_invalid_utf8_arg(self):
278278
code = 'import sys, os; s=os.fsencode(sys.argv[1]); print(ascii(s))'
279279

280280
# TODO: RUSTPYTHON
281-
@unittest.expectedFailure
282281
def run_default(arg):
283282
cmd = [sys.executable, '-c', code, arg]
284283
return subprocess.run(cmd, stdout=subprocess.PIPE, text=True)
285284

286285
# TODO: RUSTPYTHON
287-
@unittest.expectedFailure
288286
def run_c_locale(arg):
289287
cmd = [sys.executable, '-c', code, arg]
290288
env = dict(os.environ)
@@ -293,7 +291,6 @@ def run_c_locale(arg):
293291
text=True, env=env)
294292

295293
# TODO: RUSTPYTHON
296-
@unittest.expectedFailure
297294
def run_utf8_mode(arg):
298295
cmd = [sys.executable, '-X', 'utf8', '-c', code, arg]
299296
return subprocess.run(cmd, stdout=subprocess.PIPE, text=True)

0 commit comments

Comments
 (0)