question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python testing do not run tests with decorator @file_data(from ddt import file_data)

See original GitHub issue

Environment data

  • VS Code version: 1.60.1
  • Extension version (available under the Extensions sidebar): v2021.9.1230869389
  • OS and version: Fedora 33
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): virtualenv
  • Relevant/affected Python packages and their versions: N/A
  • Relevant/affected Python-related VS Code extensions and their versions: Pylance v2021.9.1
  • Value of the python.languageServer setting: Pylance

Expected behaviour

All unittest will be run.

Actual behaviour

Click “run tests” runs all testcases expect testcases with decorator @file_data which is imported from ddt module. I copy the test data out, and set them in decorator @data, tests runs OK.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wswldcommented, Sep 27, 2021

Hey @karthiknadig, @wind-chh I have merged the PR with a proposed fix for that (ddt==1.4.3). Please see if that fixes your issue.

0reactions
wind-chhcommented, Sep 30, 2021

@wswld @karthiknadig Thank you! It works well for me now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Example usage — DDT 1.5.0 documentation - Read the Docs
Example usage¶. DDT consists of a class decorator ddt (for your TestCase subclass) and two method decorators (for your tests that want to...
Read more >
Multiply your Python Unit Test Cases with DDT
DDT (Data-Driven Tests) is a small python module that allows you to multiply your unit test cases for free. The idea is pretty...
Read more >
Python unittest does not run tests - Stack Overflow
I corrected the module import, but the 'run configuration' was still there, causing it to run as a Python script and not as...
Read more >
unittest — Unit testing framework — Python 3.11.1 ...
If setUp() succeeded, tearDown() will be run whether the test method succeeded or not. Such a working environment for the testing code is...
Read more >
Python unittest tests do not work unless running within a ...
The workaround for the issue is: create a vscode workspace; use 'File->Add folder to workspace' to add the python folder to the workspace;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found