nose-devs/nose — Issue #502: class transplant mechanism disrupts test class marking mechanisms
Author: vmalloc
Created: 2012-03-07 21:53:09+00:00
State: open

Hi,

I recently wrote a small utility library for test authoring. Among the utilities that are there is a class decorator to mark a test as abstract:

```python
@abstract_test_base
class BaseTest(TestCase): # this test will not be run
def test__something(self):
...
class ConcreteTest(BaseTest):
def setUp(self):
... # automatically inherits all test methods
```
This feature is very useful for test composition and preventing code duplication. The way I currently implement it is via a marker on the test class itself.

However, the transplant_class mechanism present in nose renders this trick useless. Also, since it essentially inherits from the original class, it renders any alternative attempt at an implementation useless...

Could this have a workaround? Could you provide an alternative mechanism inside nose? can you provide a hook to be called when a transplant takes place?

Thanks in advance.