Skip to content

unittest runner thinks failing test is not run #17561

Closed
@programmerjake

Description

@programmerjake

Environment data

  • VS Code version: 1.60.2
  • Extension version (available under the Extensions sidebar): v2021.9.1246542782
  • OS and version:
    Ubuntu 20.04.3 LTS
    Linux x86_64 5.4.0-88-generic
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.10
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: none?
  • Relevant/affected Python-related VS Code extensions and their versions: none?
  • Value of the python.languageServer setting: pylance

Expected behaviour

Reports failed test

Actual behaviour

Reports passing test/thinks test is still not run

Steps to reproduce:

Run below test using vscode:

import unittest


class Tests(unittest.TestCase):
    def test(self):
        with self.subTest():
            assert False

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

> ~/.virtualenvs/libre-riscv-venv/bin/python ~/.vscode/extensions/ms-python.python-2021.9.1246542782/pythonFiles/visualstudio_py_testlauncher.py --us=. --up=*test*.py --uvInt=2 --result-port=35131 -ttest_reproducer.Tests.test --testFile=/home/jacob/projects/libreriscv/simd_signal/test_reproducer.py
cwd: ~/projects/libreriscv/simd_signal

Output for Test Output in the Terminal panel


Running tests (unittest): /home/jacob/projects/libreriscv/simd_signal/test_reproducer.py
Running tests: [object Object]
Total number of tests expected to run: 1
Total number of tests run: 1
Total number of tests passed: 0
Total number of tests failed: 0
Total number of tests failed with errors: 0
Total number of tests skipped: 0
Finished running tests!


> Test run finished at 9/28/2021, 5:56:12 PM <

Output for Python Test Log in the Output panel

test (test_reproducer.Tests) ... 
======================================================================
FAIL: test (test_reproducer.Tests) (<subtest>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jacob/projects/libreriscv/simd_signal/test_reproducer.py", line 7, in test
    assert False
AssertionError

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (failures=1)

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions