Skip to content

Stderr output causes test discovery to show as failed #7095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alexkirsz opened this issue Aug 24, 2019 · 2 comments
Closed

Stderr output causes test discovery to show as failed #7095

alexkirsz opened this issue Aug 24, 2019 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@alexkirsz
Copy link

alexkirsz commented Aug 24, 2019

Environment data

  • VS Code version: 1.37.1
  • Extension version (available under the Extensions sidebar): 2019.8.30787
  • OS and version: macOS 10.14.6
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.8
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: pytest 4.3.1
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): Jedi

Running inside of a Docker container

Expected behaviour

Test discovery completes successfully.

Actual behaviour

The extension logs the following message:

python /root/.vscode-server/extensions/ms-python.python-2019.8.30787/pythonFiles/testing_tools/run_adapter.py discover pytest -- -s --cache-clear
Test Discovery failed: 
Error: You are using pip version 19.0.3, however version 19.2.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Upgrading pip to remove the warning fixes the issue. However, this is but a warning and should not cause test discovery to fail (or, as I suspect in this case, to just display as failed).

Steps to reproduce:

Have running pytest output some kind of warning to stderr.

@alexkirsz alexkirsz added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Aug 24, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Aug 26, 2019
@kimadeline
Copy link

Hello @alexkirsz 👋 Thank you for reaching out. I tried reproducing your issue by writing to stderr inside a test in multiple ways, but pytest discovered and ran the tests without issues.

📋 Here's the content of my test file:

import logging
import sys
import warnings

def test_write_stderr():
    sys.stderr.write("Write something to stderr")

def test_warnings():
    warnings.warn("Warn something")

def test_logger_warning():
    logger = logging.getLogger(__name__)
    logger.warning("Logger warning")

def test_logger_error():
    logger.error("Logger error")

pip uses logger.warning to display their message (see their repo), it shouldn't have any influence on test discovery.

Could you please provide repro steps and/or sample code?

@kimadeline kimadeline added the info-needed Issue requires more information from poster label Aug 26, 2019
@brettcannon
Copy link
Member

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.

@ghost ghost removed the triage label Oct 9, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants