Comments (6)
Yes, you can.
For instance:
import unittest
from ddt import ddt, data
@ddt
class ThingTest(unittest.TestCase):
@data(3, 4, 5)
def test_equal(self, n):
self.assertEqual(4, n)
When running discovery you get the following test methods:
test_stuff.ThingTest.test_equal_1_3
test_stuff.ThingTest.test_equal_2_4
test_stuff.ThingTest.test_equal_3_5
To run one:
python -m unittest test_stuff.ThingTest.test_equal_2_4
However, I don't know why your command syntax does not work
from ddt.
Just wanted to say that I myself have migrated to pytest
so I won't be spending much time on this issue.
But good to see that it has been acknowledged :)
from ddt.
I can confirm the syntax suggested by @tadly is not supported at the moment, the right way to use it is like shown by @Arrowana. It's a bummer since discovering tests by substring would be most beneficial.
If anyone has a vision how this could be implemented, a pull request is welcome. I will probably investigate it at some point but for now there are more pressing issues with this package.
from ddt.
When running discovery
How to run 'discovery'? I can't find the option into nose how to do that, without it the method names are hidden :-(
from ddt.
I found one workaround: if I comment out docstring of the test function, I can see the function name: that is the only way I found to discover that - anything else (-v 3, etc) does no help
from ddt.
from ddt.
Related Issues (20)
- Add @named_data to give tests meaningful names. HOT 1
- Consider dropping support for all EOL versions Python 2.7 - 3.6 HOT 1
- How to import `named_data`? HOT 1
- Allow `named_data` to take tuples (any `collections.Sequence`)
- Async tests no longer work on python 3.11
- sdist is missing `tox.ini` HOT 6
- 1.7.0: `flake8` reports `pycodestyle` errors HOT 5
- 1.7.0: Has Python 2.7 classifiers but is Python 3+ only. HOT 2
- ddt interaction with setUp and tearDown HOT 2
- Django runserver finds that @file_data has loaded the data and cannot be changed[Help me] HOT 1
- Test Case Ordinal Numbering zero-pads poorly HOT 1
- Index only test names HOT 1
- New release causes error on import HOT 4
- 1.4.1: test suite is failing HOT 2
- Cleanup
- Docs → Example Usage: contents of example data files not shown? HOT 1
- (DDT+Excel+Unittest)How to control the execution of each test case HOT 2
- Test failure with PyYAML 5.4.1 HOT 4
- Signature change of `ddt.idata` in 1.4.3 breaks downstream uses
- @ifile_data - an iterable @file_data decorator HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ddt.