Comments (11)
What would mock do as a class decorator?
Original comment by fuzzyman
on 10 Jun 2010 at 9:55
from mock.
it would wrap every test method in a testcase
Original comment by [email protected]
on 10 Jun 2010 at 11:09
from mock.
Wrap every test method in a testcase? Eh? (In unittest all test methods become
separate TestCase instances anyway.) What does that have to do with mock?
Do you mean patch as a class decorator, automatically wrapping a patch
decorator round every test method instead of having to decorate them separately?
Original comment by fuzzyman
on 10 Jun 2010 at 11:18
from mock.
Original comment by fuzzyman
on 10 Jun 2010 at 11:19
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from mock.
> Do you mean patch as a class decorator, automatically wrapping a patch
decorator round every test method instead of having to decorate them separately?
Exactly :)
Original comment by [email protected]
on 10 Jun 2010 at 11:22
from mock.
Right - so given your comment on issue 30 I think what you mean is to allow
patch to work as a class decorator; the equivalent of patching every test
method. That sounds like a good feature. Again, I would be open to patches
(with tests and docs).
Want to help me maintain mock? There are lots of open issues here you could
comment on...
Original comment by fuzzyman
on 10 Jun 2010 at 11:24
from mock.
Sure, I'll get to it this evening.
Original comment by [email protected]
on 10 Jun 2010 at 11:57
from mock.
Original comment by fuzzyman
on 12 Jun 2010 at 10:58
- Changed state: Accepted
from mock.
Test methods are unfortunately identified by the TestLoader.testMethodPrefix
attribute. That means from a TestCase class you can't *tell* which methods will
later be used as tests.
For initial implementation we could recognise test methods as ones that start
with 'test'. Maybe consider making it configurable as a feature request for
future releases.
Original comment by fuzzyman
on 12 Jun 2010 at 11:03
from mock.
Original comment by fuzzyman
on 12 Jun 2010 at 11:22
from mock.
Original comment by [email protected]
on 12 Jun 2010 at 12:49
- Changed state: Fixed
from mock.
Related Issues (20)
- Crash on comparing call_args with long strings
- Bug on call() comparison HOT 7
- Cannot autospec mock builtins.print in python3.4
- deepcopying property of mock with spec breaks mocked calls
- Assigning mock property as another mock fails? HOT 3
- Invalid calls info when mock object called with updated dict as arg HOT 2
- Call stack on function calls making changes to dictionary fails at assertions of arguments because the dictionary changes. HOT 4
- Make call assertion errors align visually HOT 1
- Remove redundant code
- mock patch autospec doesn't work on staticmethods
- side_effect Does Not Work With autospec HOT 3
- Unexpected behaviour of assert_has_calls with empty list as argument
- copy.copy(sentinel.foo) is not sentinel.foo
- assert_called_with scope issues
- Include wheels on the PyPI distribution
- MagicMock.__truediv__ doesn't work on python3
- assert_has_calls does NOT consider order HOT 1
- create_autospec causes error in python3.4 HOT 2
- Cannot patch unittest.main.os because of how unittest imports main HOT 1
- "wraps" should work with "side_effect"
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 mock.