Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Test discovery fails with pytest-libfaketime #15669

Copy link
Copy link
@giallu

Description

@giallu
Issue body actions

Environment data

VS Code Version: 1.54.2
Commit: fd6f3bce6709b121a895d042d343d71f317d74e7
Date: 2021-03-11T00:56:09.783Z (4 days ago)
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Darwin x64 19.6.0

  • Extension version (available under the Extensions sidebar): v2021.2.636928669

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.2

  • Type of virtual environment used: pipenv

  • Value of the python.languageServer setting: Jedi

Expected behaviour

Tests are correctly discoverd

Actual behaviour

Test discovery fails with when pytest-libfaketime is installed

Steps to reproduce:

I created a small repo to easily reproduce the issue:
https://github.com/giallu/vscodetest

  1. clone the repo and create the virtual env with pipenv install
  2. Discover tests using pytest and root set to . or animals
  3. open the project in vscode: tests discovery and test running works
  4. install pytest-libfaketime with pipenv install pytest-libfaketime
  5. test discovery fails like this:
Test Discovery failed: 
SyntaxError: Unexpected end of JSON input

Logs

I am attaching here the Python Test Log window content; I tried in sequence: discover tests, run tests (install pytest-libfaketime), discover tests, run tests.

Interestingly, tests are a success before and after the library installation, it's only the discovery phase that is failing.

python /Users/giallu/.vscode/extensions/ms-python.python-2021.2.636928669/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir /Users/giallu/vscodetest -s --cache-clear .
============================= test session starts ==============================
platform darwin -- Python 3.9.2, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
django: settings: vscodetest.settings (from ini)
rootdir: /Users/giallu/vscodetest, configfile: pytest.ini
plugins: django-4.1.0
collected 1 item

animal/tests.py .                                                        [100%]

- generated xml file: /var/folders/j8/_m5rss0s475_92j2207sdhxh0000gn/T/tmp-23058OVmOvk3C0G3U.xml -
============================== 1 passed in 0.52s ===============================
python /Users/giallu/.vscode/extensions/ms-python.python-2021.2.636928669/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir /Users/giallu/vscodetest -s --cache-clear .
Test Discovery failed: 
SyntaxError: Unexpected end of JSON input
python /Users/giallu/.vscode/extensions/ms-python.python-2021.2.636928669/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir /Users/giallu/vscodetest -s .
Test Discovery failed: 
SyntaxError: Unexpected end of JSON input
re-exec with libfaketime dependencies
============================= test session starts ==============================
platform darwin -- Python 3.9.2, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
django: settings: vscodetest.settings (from env)
rootdir: /Users/giallu/vscodetest, configfile: pytest.ini
plugins: libfaketime-0.1.2, django-4.1.0
collected 1 item

animal/tests.py .                                                        [100%]

- generated xml file: /var/folders/j8/_m5rss0s475_92j2207sdhxh0000gn/T/tmp-230583iuiT9nNMlnD.xml -
============================== 1 passed in 0.55s ===============================

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable bugIssue 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

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.