adamchainz/pytest-restrict

Group multiple tests in a class does not work with None restriction.

Closed this issue · 1 comments

I think Group multiple tests in a class should be allowed if we have restricted option specified like that: --restrict-types=None,django.test.TestCase.

We could have test classes without a base class at all together with classes which inherits from Django TestCase.

What do you think?

Have a good day 🎉

Best regards,
Artem.

Using "no" base would basically be the same as allowing any class, since they inherit from object, and issubclass(X, object) is True for (nearly) any Python class.

I suggest you make your own 'empty' test class:

class TestBase:
    pass

Use that everywhere and then do --restrict-types=myproject.test.TestBase,django.test.TestCase.

None already has the special meaning of non-class tests so I wouldn't want to override it.

Thanks,

Adam